DYLD_LIBRARY_PATH not getting set in a script file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers DYLD_LIBRARY_PATH not getting set in a script file
# 1  
Old 05-04-2009
Data DYLD_LIBRARY_PATH not getting set in a script file

Hi all!

I'm a Unix noob, (just got my first os x machine, the aluminum Macbook 2.4GHz) and installed ns2 (network simulator) on it. NS2 requires you to add a path to the DYLD_LIBRARY_PATH and TCL_LIBRARY variables, which I set successfully using these commands from the command prompt:

Code:
export DYLD_LIBRARY_PATH=/Users/Dorna/ns-allinone-2.33/otcl-1.13:/Users/Dorna/ns-allinone-2.33/lib

export TCL_LIBRARY=/Users/Dorna/ns-allinone-2.33/tcl8.4.18/library

And when I set the variabes this way NS2 runs fine in that session. I read about how its not good to set these variables in your .profile file, so I'm trying to write a script (nsinit.sh) to execute these two commands every time I'm trying to run ns.

Code:
export DYLD_LIBRARY_PATH="/Users/Dorna/ns-allinone-2.33/otcl-1.13:/Users/Dorna/ns-allinone-2.33/lib"

export TCL_LIBRARY="/Users/Dorna/ns-allinone-2.33/tcl8.4.18/library"

I made my script executable using "chmod -x nsinit.sh".

And nothing happens!! I echo the variables after I run the script, and they're empty. I tried so many different variations of these commands, with or without quotes, etc, and the variables never get set.

Please help me, I'm so confused!!
# 2  
Old 05-05-2009
Did you source the script - ie., use either the source command or the dot-space command notation?
Code:
source nsinit.sh
# or --
. nsinit.sh

# 3  
Old 05-05-2009
THANKS!! That fixed it!! I had never heard of this before, what does it mean to source the script? I thought the chmod things was enough. So I should always call it like this?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract file names from file and set variable to 'highest' one

HI Folks - I have a requirement where I need to scan a text file for a list of files. The file, we'll called it, files.txt looks like such: inbox/EBS/Client_GL_Detail_PBCS_112517_SEP2017.txt inbox/EBS/Client_GL_Detail_PBCS_112617_NOV2017.txt ... (9 Replies)
Discussion started by: SIMMS7400
9 Replies

2. Shell Programming and Scripting

Help needed with shell script to search and replace a set of strings among the set of files

Hi, I am looking for a shell script which serves the below purpose. Please find below the algorithm for the same and any help on this would be highly appreciated. 1)set of strings need to be replaced among set of files(directory may contain different types of files) 2)It should search for... (10 Replies)
Discussion started by: Amulya
10 Replies

3. Shell Programming and Scripting

Script to set password in HP-UX 11.31

Hi, I am unable to set the password remotely. I am using the script as below: ep=`echo "$p" | /usr/lbin/makekey` ssh -t $i "/usr/local/bin/sudo useradd -c "$user_c" -m -d /home/$user_id -s /bin/ksh $user_id; /usr/local/bin/sudo /usr/sam/lbin/usermod.sam -F -p $ep $user_id" The... (0 Replies)
Discussion started by: Kits
0 Replies

4. Shell Programming and Scripting

script set up required

Hi, I have a configuration file name (tar_config2.sh)which has the following enteries .... here 10 represents days(mofification time), /home/admin/files represents source folder from where the files will be picked up /home/admin/output represents whwre the files will be kept so it is a... (11 Replies)
Discussion started by: suchitasinha123
11 Replies

5. Shell Programming and Scripting

Filter a .kml file (xml) with data set from text file

I have a .kml file. So I want filter the .kml to get only the tags that have this numeric codes that they are in a text file 11951 11952 74014 11964 11965 11969 11970 11971 11972 60149 74018 74023 86378 11976 11980 11983 11984 11987 (5 Replies)
Discussion started by: pcoj33
5 Replies

6. Shell Programming and Scripting

set -x within script and capture as a file

Okay, I've been working on a script for providing information on the progress of a backgrounded ditto command. Thanks to google and a lot of searching I've resolved all but one very odd error. At this point, I want to use xtrace (set -x) to try to uncover the issue. I have found several examples... (2 Replies)
Discussion started by: reid
2 Replies

7. UNIX for Advanced & Expert Users

set in script

hi, when I try executing ls -l|while read line do set "$line" ( not working if I say set $line with out double quote then it is working.... if then .... fi Any idea? (1 Reply)
Discussion started by: shahnazurs
1 Replies

8. Shell Programming and Scripting

Ksh script - Design ? - Search file and set variables

Hi - I'm trying to think of a clever way to write a shell script (trying to stay w/ ksh as that's what I know the best...) that will resolve the following problem: Problem - On a daily basis I have to email folks who are on-call to remind them. I was hoping to script this out so I could have... (9 Replies)
Discussion started by: littlefrog
9 Replies

9. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies
Login or Register to Ask a Question