Created
November 25, 2010 03:11
-
-
Save jesstess/714837 to your computer and use it in GitHub Desktop.
cycle through colors with each new shell 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
export colorvar=31; export PROMPT_COMMAND='export PS1="\e[""$colorvar"";40m\w> "; colorvar=$(((colorvar + 1) % 7 + 31));' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
andersk educates me, as usual:
export PROMPT_COMMAND='export PS1="[\e[$(($LINENO % 7 + 31))m]\w> "'
"The [ ~ ] tells bash where the non-printing escape sequence is so that it can correctly calculate the width of the prompt, to avoid display bugs when you type a command longer than the terminal width."