[Insight-developers] Bash shell prompt customization
    Bill Lorensen 
    bill.lorensen at gmail.com
       
    Mon Sep 27 14:43:50 EDT 2010
    
    
  
Folks,
I'm sure the experts already know this, but if you are using the bash
shell, you can customize the prompt to show which git branch is
active.
Here is what I added to my ~/.bashrc file:
parse_git_branch()
  {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
  }
export PS1="[\[\e[01;34m\]\W\[\e[31m\]\$(parse_git_branch)\[\e[00m\]]\[\e[00m\]
"
It shows up like this:
[ITKPersonal(gdcmWarnings)]  (with colors!)
There is a lot more you can add to the prompt (like username, host,
etc), but I like to keep mine short,
Bill
    
    
More information about the Insight-developers
mailing list