Skip to content

Instantly share code, notes, and snippets.

@tom--
Last active June 8, 2018 23:54
Show Gist options
  • Save tom--/8345107 to your computer and use it in GitHub Desktop.
Save tom--/8345107 to your computer and use it in GitHub Desktop.
A fancy bash prompt. Put it in your .bashrc
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
bold=$(tput bold)
dim=$(tput dim)
off=$(tput sgr0)
thumb () {
case $1 in
0) printf "\xF0\x9F\x91\x8d" ;;
*) printf "\xF0\x9F\x91\x8e $red($1)$off" ;;
esac
}
case "$SUDO_USER" in
"") prompt="$" ;;
*) prompt="$red$bold#$off" ;;
esac
export PS1="$yellow$dim\u@\h [\w] \$(thumb \$?)$off \n$prompt "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment