CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Installation

Setting environment variables: bash issue

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 30, 2012, 04:29
Default Setting environment variables: bash issue
  #1
New Member
 
av
Join Date: Feb 2012
Posts: 5
Rep Power: 5
travonz is on a distinguished road
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
travonz is offline   Reply With Quote

Old   July 30, 2012, 17:12
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,312
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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'
For more on this kind of details: Advanced tips for working with the OpenFOAM shell environment

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   July 31, 2012, 03:17
Default
  #3
New Member
 
av
Join Date: Feb 2012
Posts: 5
Rep Power: 5
travonz is on a distinguished road
Great !

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

sincerely,

Xavier
travonz is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Environment variables- to solve problems in compiling UDF in Fluent Modest Cat Fluent UDF and Scheme Programming 37 March 30, 2015 05:25
Issue with tcsh vs bash shells Gary_cfd OpenFOAM Installation 1 June 21, 2012 17:06
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56
Setting up Enviromental Variables hasan_hzl ANSYS 0 December 5, 2009 05:46
FloWorks (Flow Express) Volume Goal Setting Issue rbigelow FloEFD, FloWorks & FloTHERM 1 November 16, 2009 02:32


All times are GMT -4. The time now is 16:38.