Created
September 2, 2011 06:30
-
-
Save todesking/1188031 to your computer and use it in GitHub Desktop.
my PS1 for bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __show_errorcode() { | |
ERR=$? | |
if [ $ERR != 0 ]; then | |
echo -en "\033[31m\$?=$ERR" | |
fi | |
} | |
function __show_jobs() { | |
JOBS=$(jobs|sed 's/ \+/\t/g'|cut -f1,3|tr \\t :|tr \\n ','|sed 's/,$//'|sed 's/,/, /g') | |
if [ "$JOBS" != "" ]; then | |
echo " ($JOBS)" | |
fi | |
} | |
# export GIT_PS1_SHOWUPSTREAM=1 | |
export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
export GIT_PS1_SHOWSTASHSTATE=1 | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export PS1='$(__show_errorcode) \[\033[33m\]\w$(__git_ps1)\[\033[0m\]$(__show_jobs) | |
\[\033[32m\][$(date +"%m-%d %H:%M:%S")]\[\033[0m\] $ ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment