Tip/Foam version in shell prompt

From OpenFOAMWiki

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 want to distinguish Debug and Opt versions use

 
export PS1="(\${WM_FORK:=OF}:\$WM_PROJECT_VERSION-\$WM_COMPILE_OPTION) $PS1"

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)

If you use the more recent configuration files from grml then you have to add this information to the two standard-themes (setting PS1 won't work anymore):

 
function openfoam_version_prompt () {
    REPLY="%U(OF:$WM_PROJECT_VERSION-$WM_COMPILE_OPTION)%u "
}
grml_theme_add_token ofversion -f openfoam_version_prompt '%F{magenta}' '%f'
 
zstyle ':prompt:grml:left:setup' items rc ofversion change-root user at host path vcs percent
zstyle ':prompt:grml-large:left:setup' items rc jobs history shell-level change-root time date newline ofversion user at host path vcs percent
 
# this is optional and generates a two-line prompt:
prompt grml-large