Skip to content

Instantly share code, notes, and snippets.

@rpetrano
Created October 27, 2016 15:44
Show Gist options
  • Save rpetrano/23e5e8ec001c62303d31f5c78550d646 to your computer and use it in GitHub Desktop.
Save rpetrano/23e5e8ec001c62303d31f5c78550d646 to your computer and use it in GitHub Desktop.
Bash prompt color tip
PS1='[\e[00;32m\u\e[0m@\e[00;31m\h\e[0m \e[00;34m\w\e[0m]\$ '
PS1='[\[\e[00;32m\]\u\[\e[0m\]@\[\e[00;31m\]\h\[\e[0m\] \[\e[00;34m\]\w\[\e[0m\]]\$ '
ps1() {
green="\[$(tput sgr0)$(tput setf 2)\]"
red="\[$(tput sgr0)$(tput setf 4)\]"
blue="\[$(tput sgr0)$(tput setf 1)\]"
normal="\[$(tput sgr0)\]"
echo "$normal[$green\u$normal@$red\h $blue\w$normal]$ "
}
PS1="$(ps1)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment