LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-29-2003, 10:12 AM   #1
slinkysteve
LQ Newbie
 
Registered: Jun 2003
Distribution: Debian 3.1
Posts: 11

Rep: Reputation: 0
can save new $PATH variables


hi, I'm having great difficulty in running this shell script in order to set up the $PATH and $LD_LIBRARY_PATH variables.

Quote:
#!/bin/sh
p1=/usr/src/ns-allinone-2.26/bin
p2=/usr/src/ns-allinone-2.26/otcl-1.0a8
p3=/usr/src/ns-allinone-2.26/lib
p4=/usr/src/ns-allinone-2.26/lib/tcl8.3
p5=/usr/src/ns-allinone-2.26/lib/tk8.3

PATH=$PATH:$p1:$p2:$p3:$p4:$p5
export PATH
$PATH

LD_LIBRARY_PATH=$p3:$p4:$p5
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
$LD_LIBRARY_PATH
ns $1
Its supposed to setup the paths so I can run NS2 Network Simulator but when I try to run it as root (using "su" command) I get the following problems:

Quote:
[root@localhost Downloads]# sh ./run-ns.sh
./run-ns.sh: line 10: export: `/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/src/ns-allinone-2.26/bin:/usr/src/ns-allinone-2.26/otcl-1.0a8:/usr/src/ns-allinone-2.26/lib:/usr/src/ns-allinone-2.26/lib/tcl8.3': not a valid identifier6/lib/tk8.3
./run-ns.sh: line 12: /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/src/ns-allinone-2.26/bin:/usr/src/ns-allinone-2.26/otcl-1.0a8:/usr/src/ns-allinone-2.26/lib:/usr/src/ns-allinone-2.26/lib/tcl8.3:/usr/src: No such file or directory
: command not found3:
: command not found6:
./run-ns.sh: line 17: /usr/src/ns-allinone-2.26/lib:/usr/src/ns-allinone-2.26/li: No such file or directoryne-2.26/lib/tk8.3
: command not found8:
%
End result being that no $PATHs have been changed. I'm completely new to this setting of PATH variables and the like so I was hoping someone could help me out

I'm running Mandrake 9.1 with GNOME 2.2

Thanks

Steve
 
Old 10-29-2003, 10:30 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Code:
#!/bin/sh
p1=/usr/src/ns-allinone-2.26/bin
p2=/usr/src/ns-allinone-2.26/otcl-1.0a8
p3=/usr/src/ns-allinone-2.26/lib
p4=/usr/src/ns-allinone-2.26/lib/tcl8.3
p5=/usr/src/ns-allinone-2.26/lib/tk8.3

export PATH=$PATH:$p1:$p2:$p3:$p4:$p5
export LD_LIBRARY_PATH=$$p3:$p4:$p5

echo Path is $PATH, Ld.. is $LD_LIBRARY_PATH
ns $1
Works for me. The path settings are not permanent but apply only to the subshell in question (that is, they are forgotten when script returns). If you want to have a script that changes the path of the current session, you have to run it with source command ("source ./thescript" or ". ./thescripit" instead of "./thescript".)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Extra path variables? mjm461 Linux - General 1 09-15-2005 02:21 PM
Setting PATH and other variables durrantj Ubuntu 2 08-25-2005 07:44 PM
adding $PATH variables karupt Linux - Newbie 5 03-07-2004 06:27 PM
removing path variables globally Nevetsmik103081 Linux - General 1 07-05-2003 01:17 PM
rh7.1 environment variables (eg path) dave_lane Linux - Newbie 1 09-20-2001 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration