Skip to content

Instantly share code, notes, and snippets.

@cloudhead
Created September 5, 2009 03:36
Show Gist options
  • Save cloudhead/181278 to your computer and use it in GitHub Desktop.
Save cloudhead/181278 to your computer and use it in GitHub Desktop.
CLEAR=$'\e[00m'
BLACK=$'\e[0;30m'
RED=$'\e[0;31m'
GREEN=$'\e[0;32m'
YELLOW=$'\e[0;33m'
BLUE=$'\e[0;34m'
PURPLE=$'\e[0;35m'
CYAN=$'\e[0;36m'
WHITE=$'\e[0;37m'
function prompt {
STATUS=$?
# Branch
if git diff --quiet 2>/dev/null >&2
then
echo "$GREEN$(__git_ps1)$CLEAR"
else
echo "$YELLOW$(__git_ps1)$CLEAR"
fi
# Status
if [ $STATUS == 0 ]; then
echo "$GREEN\$$CLEAR"
elif [ $STATUS == 1 ]; then
echo "$YELLOW\$$CLEAR"
else
echo "$RED\$$CLEAR"
fi
}
export PS1="$YELLOW\t$CLEAR $CYAN\u@\h$CLEAR \w\$(prompt) "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment