-
-
Save yabberyabber/b482c847cc42368cb62754d4aba043ff to your computer and use it in GitHub Desktop.
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 [ -z "$WP" ]; then | |
# $WP is empty... you are not in a chroot workspace | |
export PS1="\[\033[0;31m\]"$PS1"\[\033[0m\]" | |
else | |
# $WP contains the name of the project you're currently in | |
export PS1="\[\033[0;37m\]"$WP": "$PS1"\[\033[0m\]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Non printable characters (like
\033[0;37m
) must be wrapped in\[ blah blah blah \]
.If not, bash doesn't know how many characters long the prompt is and when you type long commands they won't wrap properly.
If your terminal has a light background, consider different colors. I have PS1="[\033[0;42m]"$WP": "$PS1"[\033[0m]" because my background is white and I couldn't read gray against white.