Skip to content

Instantly share code, notes, and snippets.

@irq0
Created November 15, 2013 20:47
Show Gist options
  • Save irq0/7491283 to your computer and use it in GitHub Desktop.
Save irq0/7491283 to your computer and use it in GitHub Desktop.
TXTBLK='\e[0;30m' # Black - Regular
TXTRED='\e[0;31m' # Red
TXTGRN='\e[0;32m' # Green
TXTYLW='\e[0;33m' # Yellow
TXTBLU='\e[0;34m' # Blue
TXTPUR='\e[0;35m' # Purple
TXTCYN='\e[0;36m' # Cyan
TXTWHT='\e[0;37m' # White
BLDBLK='\e[1;30m' # Black - Bold
BLDRED='\e[1;31m' # Red
BLDGRN='\e[1;32m' # Green
BLDYLW='\e[1;33m' # Yellow
BLDBLU='\e[1;34m' # Blue
BLDPUR='\e[1;35m' # Purple
BLDCYN='\e[1;36m' # Cyan
BLDWHT='\e[1;37m' # White
UNDBLK='\e[4;30m' # Black - Underline
UNDRED='\e[4;31m' # Red
UNDGRN='\e[4;32m' # Green
UNDYLW='\e[4;33m' # Yellow
UNDBLU='\e[4;34m' # Blue
UNDPUR='\e[4;35m' # Purple
UNDCYN='\e[4;36m' # Cyan
UNDWHT='\e[4;37m' # White
BAKBLK='\e[40m' # Black - Background
BAKRED='\e[41m' # Red
BAKGRN='\e[42m' # Green
BAKYLW='\e[43m' # Yellow
BAKBLU='\e[44m' # Blue
BAKPUR='\e[45m' # Purple
BAKCYN='\e[46m' # Cyan
BAKWHT='\e[47m' # White
TXTRST='\e[0m' # Text Reset
if [ -z "$TITLEBAR" ]; then
case $TERM in
xterm*|rxvt*)
# TITLEBAR="\[\033]0;\u@\h:<\$(echo \w | tr -c -d '/' | wc -c)>/\$(basename \w) \007\]"
TITLEBAR="\[\033]0;\u@\h:\W\007\]"
;;
screen)
TITLEBAR="\[\033]0;SCREEN@\h\007\]"
;;
*)
TITLEBAR=""
;;
esac
fi
case "`hostname`" in
"ferrari" | "slack")
# workstation variant - git-branch, dir size
export PS1="$TITLEBAR$BLDGRN\u@\h \`ret=\$?; if [ \$ret = 0 ]; then echo '${BLDGRN} :) '; else echo \"${BLDRED} FAIL (\$ret) \"; fi\`$BLDYLW !\! $BLDBLU\$(ls -lah | grep -m 1 total | sed 's/total //') $BLDRED\$(git branch
;;
"daria")
# mac os variant - git-branch is slow..
export PS1="$TITLEBAR$BLDGRN\u@\h \`ret=\$?; if [ \$ret = 0 ]; then echo '${BLDGRN}☻'; elif [ \$ret = 1 ]; then echo '${BLDYLW}:⌉ (1)'; else echo \"${BLDRED}☹ (\$ret) \"; fi\` ${BLDPUR}\w$TXTRST\n"
;;
*)
# light version
export PS1="$TITLEBAR$BLDGRN\u@\h \`ret=\$?; if [ \$ret = 0 ]; then echo '${BLDGRN} :) '; else echo \"${BLDRED} FAIL (\$ret) \"; fi\`$BLDYLW !\! ${BLDPUR}\w$TXTRST\n"
;;
esac
# Local Variables:
# mode: sh
# End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment