Theming Bash
Subject:   Put the CVS branch name in your prompt
Date:   2006-02-03 15:38:22
From:   MatthewDoar
If you sometimes forget which branch your current sandbox of checked-out code was taken from, you can have the name of the branch appear in your shell 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]\\$ "

Change "_BRANCH" to some string that matches your local convention for CVS branches. I'm not sure how the line breaks will be handled when this appears, but the original text is also in my O'Reilly book "Practical Development Environments".


1 to 1 of 1
  1. Put the CVS branch name in your prompt
    2006-02-10 10:04:31  shlomif [View]

1 to 1 of 1