Women in Technology

Hear us Roar



Article:
  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".


~Matt

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Put the CVS branch name in your prompt
    2006-02-10 10:04:31  shlomif [View]

    I've been playing with customising shell prompts as well. See:

    http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/2549