Last active
June 8, 2018 23:54
-
-
Save tom--/8345107 to your computer and use it in GitHub Desktop.
A fancy bash prompt. Put it in your .bashrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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