Skip to content

Instantly share code, notes, and snippets.

@panta82
Created February 22, 2016 12:48
Show Gist options
  • Save panta82/b26dc656b6b4f5170f54 to your computer and use it in GitHub Desktop.
Save panta82/b26dc656b6b4f5170f54 to your computer and use it in GitHub Desktop.
Bash color prompt
##############################
# Colorized bash prompt
echo_git_branch() {
local branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
if [[ ! -z "$branch" ]]; then
printf "(%s) " $branch
fi
}
PROMPT_DIRTRIM=3
export PS1="\\[\033[00m\\]\\[\e[38;5;76m\\]\u\\[\033[01;34m\\] \w \\[\033[31m\\]\$(echo_git_branch)\\[\033[00m\\]$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment