2/11/2007

Problem during environmental variable setting under Ubuntu

I've been working on making NS-2(Network Simulator 2) working today. After the installation, you have to add some environmental variables. Follow the instructions below:

----------------------------------------------------------------------------------

Please put /home/george/ns-allinone-2.30/bin:/home/george/ns-allinone-2.30/tcl8.4.13/unix:/home/george/ns-allinone-2.30/tk8.4.13/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/george/ns-allinone-2.30/otcl-1.12, /home/george/ns-allinone-2.30/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH <paths>
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=<paths>

(2) You MUST put /home/george/ns-allinone-2.30/tcl8.4.13/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.13
and tk8.4.13. They are now installed under /home/george/ns-allinone-2.30/{bin,include,lib}

After these steps, you can now run the ns validation suite with
cd ns-2.30; ./validate

For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.


But, you should pay special attention on the environmental variable setting.

The problem is, actually, demonstrated below:
I tried to add the following line of code in the /etc/profile,
export PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/usr/local/matlab7/bin:/home/george/ns- allinone-2.30/bin:/home/george/ns-allinone-2.30/tcl8.4.13/unix:/home/george/ns-allinone-2.30/tk8.4.13/unix"

and I logged out the system, but I found I can not start the X session. The error occurred when X was starting, and it was given like this:
line 21, export, bad variable name

At the beginning, I thought that maybe I forget to add the path to X. But, It's didn't work no matter how I modify the /etc/profile.

FINALLY, I found the point. I deleted the space between the keyword export and "=", and the space between "=" to the following path. AND IT WORKS!

Please pay attention to the difference on the following two lines of code:

export PATH = "..."
export PATH="..."

This is the reason of the early failures.


I don't know, even now, why they design like this. The space between "=" and the variable value is OKEY in almost any kind of programming language, including C/C++, JAVA, Perl, Python, Assembly etc...

Anyway, don't get frustrated if you encounter the same problem!

没有评论: