Last active
October 8, 2017 10:14
-
-
Save dundee/3c82e54a52915887c6da26d887f10dd8 to your computer and use it in GitHub Desktop.
Colorful bash prompt with git integration
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
if [[ ${EUID} == 0 ]]; then | |
PS1="\[\e[41;30m\] \w \${?/#0}\[\e[31;49m\]"$'\xee\x82\xb0'"\[\e[00m\] " | |
else | |
PS1="\[\e[44;30m\] \w \[\\e[31m\]\${?/#0}" | |
PS1="$PS1\$(\ | |
export GIT_BRANCH=\"\$(git branch --no-color 2>/dev/null | sed -n 's/*[^ ]* //p')\"; \ | |
if [ -n \"\$GIT_BRANCH\" ] ; then \ | |
echo -en \"\[\e[43;34m\]\xee\x82\xb0 \" | |
echo -en \"\[\e[43;30m\]\$GIT_BRANCH \" | |
echo -en \"\[\e[33;49m\]\xee\x82\xb0\[\e[00m\] \" | |
else | |
echo -e \"\[\e[34;49m\]"$'\xee\x82\xb0'"\[\e[00m\] \" | |
fi \ | |
)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment