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

Setting environment variables: bash issue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread 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: 14
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
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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: 14
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


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 Off
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 39 May 18, 2016 10:33
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 04:46
FloWorks (Flow Express) Volume Goal Setting Issue rbigelow FloEFD, FloWorks & FloTHERM 1 November 16, 2009 01:32


All times are GMT -4. The time now is 21:40.