Created
June 3, 2015 13:45
-
-
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.
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
# 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