LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-20-2009, 03:24 AM   #1
Umanga
Member
 
Registered: Aug 2004
Location: Sri Lanka
Distribution: Debian Etch
Posts: 36

Rep: Reputation: 15
Question calling another script , preserve environment variables?


Greetings all,

My first (main.sh) script is going to call the second script (settings.sh).I do it as follows:

Code:
#script1 - main.sh
sh config/settings.sh
echo $SGE_ROOT
echo $ARCH
echo $LD_LIBRARY_PATH

second script is as follows:

Code:
#script 2 - settings.sh
export SGE_ROOT=/SGE6.2/Root
export ARCH=lx24-amd64
export LD_LIBRARY_PATH=$SGE_ROOT/lib/ARCH/
But when I run main.sh I dont see output for the environment variables I set in settings.sh ?

Any tips?
 
Old 11-20-2009, 03:32 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Instead of:
sh config/settings.sh
Try this:
source config/settings.sh
Or shorter version:
. config/settings.sh
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo perl script with environment variables powah Programming 1 04-22-2009 11:22 AM
global environment variables in shell script a.toraby Programming 2 11-11-2007 03:25 AM
Bash script environment variables mbjunior99 SUSE / openSUSE 4 12-28-2005 12:40 AM
Need help setting environment variables via shell script srosburg Linux - Newbie 2 12-08-2005 07:58 PM
Setting environment variables from a script... sylvain_gnu Linux - Newbie 5 04-20-2004 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration