Skip to content

Instantly share code, notes, and snippets.

@mercul3s
Last active March 15, 2018 19:43
Show Gist options
  • Save mercul3s/25adeff76d208de49dd4 to your computer and use it in GitHub Desktop.
Save mercul3s/25adeff76d208de49dd4 to your computer and use it in GitHub Desktop.
rainbow bash prompt
# Bash Prompt Color Variables
blu="\[\033[34m\]"
cyn="\[\033[36m\]"
grn="\[\033[32m\]"
yel="\[\033[33m\]"
red="\[\033[31m\]"
pur="\[\033[35m\]"
gry="\[\033[37m\]"
end="\[\033[00m\]"
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# [\t] = timestamp \u = user @ \h = hostname \W = current directory $(parse_git_branch) = display git branch if in git repo
export PS1="$cyn\u$grn@$yel\h.$red\W$pur\$(parse_git_branch)$gry$ $end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment