Skip to content

Instantly share code, notes, and snippets.

@zachfedor
Created June 3, 2015 13:45
Show Gist options
  • Save zachfedor/a7a0456e78526dcd84dc to your computer and use it in GitHub Desktop.
Save zachfedor/a7a0456e78526dcd84dc to your computer and use it in GitHub Desktop.
Bash Prompt featuring colors, username, working directory, git branch, and a new line for the prompt.
# Grabs the current git branch for prompt
function current_git_branch {
BRANCH="$(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})"
if [ "$BRANCH" == "" ]
then
echo "-"
else
echo "$BRANCH"
fi
}
# See color codes here: https://wiki.archlinux.org/index.php/Color_Bash_Prompt
PS1="$RS[$FCYN\u$RS][$FCYN\w$RS][$FCYN\$(current_git_branch)\[$RESET\]$RS]\n[$FCYN>$RS] "
#PS1="$RS[$FCYN\u$RS][$FCYN\w$RS]\n[$FCYN>$RS] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment