Skip to content

Instantly share code, notes, and snippets.

@jerm
Created September 19, 2013 20:18
Show Gist options
  • Save jerm/6629246 to your computer and use it in GitHub Desktop.
Save jerm/6629246 to your computer and use it in GitHub Desktop.
My bash prompt. looks like: http://cl.ly/image/0P2p2g2c3k11 Will tell you the time, your current aws(boto) env, you current path, the results status (as a red top line) of your last command, current user (red if root (root must have this as her prompt), current hostname (red if "prod" appears in the hostname) Requires: you must have .git-complet…
source .git-completion.bash
source .git-prompt.sh
# Jeremy's color and screen and graphical term naming prompt
_boto_env(){
if [ -n "$BOTO_CONFIG" ]; then
echo "aws-${BOTO_CONFIG##*-}"
else
echo -n "aws-default"
fi
}
case "$TERM" in
xterm*|rxvt*|screen*|linux)
if [[ "`hostname`" =~ 'prod' ]]; then HCOLOR=31; else HCOLOR=33; fi
if [[ "$USER" =~ 'root' ]]; then UCOLOR=31; else UCOLOR=32; fi
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;${UCOLOR}m\]\u@\[\033[01;${HCOLOR}m\]\h\[\033[00m\]:\!:\[\033[00m\]\$ '
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
[[ $TERM =~ "screen" ]] && export PS1="\[\033k\033\134\033k\h\033\134\]$PS1"
PS1="\`if [[ \$? = "0" ]]; then echo "\\[\\033[37m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\T]:\`_boto_env\`:\[\033[00;36m\]\w"'$(__git_ps1 " (%s)")\n'"$PS1"
;;
*)
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment