Setting environment variables: bash issue
Hello,
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. #!/bin/bash source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc source $HOME/.bashrc cd $FOAM_RUN Do you know how can I keep environment after script execution ? Thanks for your help. Xavier |
Greetings Xavier and welcome to the forum!
You should resort to an alias instead, placed in your "~/.bashrc". Example for your case: Code:
alias of211combo='source /opt/OpenFOAM/OpenFOAM-2.1.1/etc/bashrc; cd $FOAM_RUN' Best regards, Bruno |
Great !
Thank you very much for your advice and for the link. sincerely, Xavier |
All times are GMT -4. The time now is 01:58. |