CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Installation (
-   -   Setting environment variables: bash issue (

travonz July 30, 2012 04:29

Setting environment variables: bash issue

I would like to automate environment initialization prior to OpenFOAM use.
I wrote the following bash script, but it doesn't work at all. Environment is only set inside script, when it exit the script and goes back to console, nothing changes, no variable has been defined.

source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc
source $HOME/.bashrc

Do you know how can I keep environment after script execution ?

Thanks for your help.


wyldckat July 30, 2012 17:12

Greetings Xavier and welcome to the forum!

You should resort to an alias instead, placed in your "~/.bashrc". Example for your case:

alias of211combo='source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc; cd $FOAM_RUN'
For more on this kind of details: Advanced tips for working with the OpenFOAM shell environment

Best regards,

travonz July 31, 2012 03:17

Great !

Thank you very much for your advice and for the link.



All times are GMT -4. The time now is 05:04.