We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
| Weblog: |
|
Changing your bash prompt hostname in Tiger
|
| Subject: |
|
Adding the CVS branch name to your prompt |
| Date: |
|
2005-10-26 09:56:33 |
| From: |
|
MatthewDoar
|
|
|
|
If you tend to forget which branch you're working on, this incantation adds (and colors) the branch name to the prompt.
export PS1="[\u@\h\$(if [ -d CVS ]; then if [ -e CVS/Tag ]; then cat CVS/Tag | sed -e 's/^T/ /' | sed -e 's/^N/ /' | sed -e 's/^D/ Date /' | sed -e 's/_BRANCH/\[\033]12;blue\007\]/'; else echo ' \[\033]12;black\007\]MAIN' ; fi; else echo '
\[\033]12;black\007\]' ;fi) \W]\\$ "
|