[Assorted-commits] SF.net SVN: assorted:[1542] shell-tools/trunk/src/bash-commons/bashrc.bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-12-31 01:16:13
|
Revision: 1542 http://assorted.svn.sourceforge.net/assorted/?rev=1542&view=rev Author: yangzhang Date: 2009-12-31 01:16:05 +0000 (Thu, 31 Dec 2009) Log Message: ----------- only show git status if avail; fixed color for exit status Modified Paths: -------------- shell-tools/trunk/src/bash-commons/bashrc.bash Modified: shell-tools/trunk/src/bash-commons/bashrc.bash =================================================================== --- shell-tools/trunk/src/bash-commons/bashrc.bash 2009-12-31 01:05:58 UTC (rev 1541) +++ shell-tools/trunk/src/bash-commons/bashrc.bash 2009-12-31 01:16:05 UTC (rev 1542) @@ -763,10 +763,20 @@ if [ $status != 0 ] then echo '"$(quote "\[$bg_dark_red\]")\$status$(quote "\[$normal_color\] ")"' fi )' + if bash --version | fgrep 'version 3' >& /dev/null ; then + local exitstatus='$( status=$? + if [ $status != 0 ] + then echo -e '"$(quote "$bg_dark_red")\$status$(quote "$normal_color ")"' + fi )' + fi local user_host="\[$fg_dark_green\]\u@\h\[$normal_color\]" local path="\[$fg_brown\]\w\[$normal_color\]" - local git_ps1="\[$fg_yellow\]\$( __git_ps1 'git(%s) ' )\[$normal_color\]" + local git_ps1 + if type __git_ps1 >& /dev/null + then git_ps1="\[$fg_yellow\]\$( __git_ps1 'git(%s) ' )\[$normal_color\]" + else git_ps1='' + fi PS1="$titlebar\n$user_host $exitstatus$datetime $path $git_ps1\n\$ " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |