Skip to content

Instantly share code, notes, and snippets.

@todesking
Created September 2, 2011 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todesking/1188031 to your computer and use it in GitHub Desktop.
Save todesking/1188031 to your computer and use it in GitHub Desktop.
my PS1 for bash
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