Skip to content

Instantly share code, notes, and snippets.

@jpmens
Forked from tom--/bash_prompt_fancy.sh
Created June 8, 2018 23:54
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 jpmens/a00fc64da6495abc9f2db603d8765cc4 to your computer and use it in GitHub Desktop.
Save jpmens/a00fc64da6495abc9f2db603d8765cc4 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