Difference between revisions of "Tip/Foam version in shell prompt"

From OpenFOAMWiki
(Tip for shell prompt)
 
m (Correction)
Line 11: Line 11:
 
export PS1="%U(OF:\$WM_PROJECT_VERSION)%u $PS1"
 
export PS1="%U(OF:\$WM_PROJECT_VERSION)%u $PS1"
 
</bash>
 
</bash>
will give you the same information (underlined)
+
in <tt>.zshrc.local</tt> will give you the same information (underlined)

Revision as of 15:57, 3 January 2012

If you're working with multiple OF-versions of OpenFOAM it can be useful if the used version of OpenFOAM is printed on the shell prompt (just like the current directory or other information you might have there).

Add

 
export PS1="(OF:\$WM_PROJECT_VERSION) $PS1"

to the end of your .bashrc and you'll have an output like (OF:1.9.x) on the left of your prompt (if the current shell uses OpenFOAM-1.9.x)

If you're a zsh-user then

 
export PS1="%U(OF:\$WM_PROJECT_VERSION)%u $PS1"

in .zshrc.local will give you the same information (underlined)