Created
February 10, 2015 20:27
-
-
Save jackprice/854d93d64779bb831e36 to your computer and use it in GitHub Desktop.
Bash PS1
This file contains hidden or 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
CHAR_FULL_TRIANGLE='\356\202\260' | |
COLOR_WHITE='\e[37m' | |
COLOR_RESET='\e[0m' | |
COLOR_GREY='\e[90m' | |
COLOR_BLUE='\e[34m' | |
COLOR_GREEN='\e[32m' | |
BG_GREY='\e[100m' | |
BG_BLUE='\e[44m' | |
BG_GREEN='\e[42m' | |
# user@hostname | |
export PS1="\[$COLOR_WHITE\]\[$BG_GREY\] \u@\h \[$COLOR_RESET\]\[$COLOR_GREY\]\[$BG_BLUE\]$CHAR_FULL_TRIANGLE" | |
# Working directory | |
export PS1="$PS1\[$BG_BLUE\]\[$COLOR_WHITE\] \w \[$COLOR_RESET\]\[$COLOR_BLUE\]$CHAR_FULL_TRIANGLE\[$COLOR_RESET\]" | |
# Git branch | |
export PS1="$PS1\$( | |
BRANCH=\$(git rev-parse --abbrev-ref HEAD 2>&1); | |
if [ \$? -eq 0 ]; then | |
echo -n '\033[1D' | |
echo -n "\\[$COLOR_BLUE\\]\\[$BG_GREEN\\]$CHAR_FULL_TRIANGLE$COLOR_RESET\\[$BG_GREEN\\]" | |
echo -n ' ' | |
echo -n "\$BRANCH" | |
echo -n ' ' | |
echo -n "\\[$COLOR_RESET\\]\\[$COLOR_GREEN\\]$CHAR_FULL_TRIANGLE\\[$COLOR_RESET\\]" | |
fi | |
)" | |
# Add a newline | |
export PS1="$PS1\n\\\$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment