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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-02-2007, 01:42 AM
|
#1
|
LQ Newbie
Registered: Oct 2007
Posts: 28
Rep:
|
setting Environment variables?
hii all, I'm very new to Linux & I'm using fedora7 for ns2, after installation i export the Environment variables this way:
>export PATH=/root/ns-allinone-2.31/bin:/root/ns-allinone-2.31/tcl8.4.14/
unix:/root/ns-allinone-2.31/tk8.4.14/unix
>export LD_LIBRARY_PATH= /root/ns-allinone-2.31/otcl-1.13:/root/ns-allinone-2.31/lib
> export TCL_LIBRARY=/root/ns-allinone-2.31/tcl8.4.14/library
but I when i check the environment variables using "env". i dont see my new variables!!
please how can i solve this problem? what im doing wrong?
Thank You
Muby
|
|
|
10-02-2007, 01:57 AM
|
#2
|
Member
Registered: Aug 2006
Distribution: Ubuntu
Posts: 87
Rep:
|
use "echo" for example to see your new PATH:
using env you can do:
HTH,
|
|
|
10-02-2007, 02:38 AM
|
#3
|
LQ Newbie
Registered: Sep 2005
Distribution: Slackware
Posts: 9
Rep:
|
Hi Muby,
I think that the problem comes from the fact you override the PATH
environment variable. As a result, when you try to use 'env' command,
the shell does not know where it is.
You should try like this:
Code:
export PATH=${PATH}:/root/ns-allinone-2.31/bin:/root/ns-allinone-2.31/tcl8.4.14/unix:/root/ns-allinone-2.31/tk8.4.14/unix
Proceeding this way allows you to add new paths to the existing list of paths of the PATH variable.
HTH,
|
|
|
10-02-2007, 02:50 AM
|
#4
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
Furthermore, take in mind that if you export a variable from the command line, it will be available to the open shell only (that is if you open another terminal you start a new shell which will not be aware of the modified environment). To make your changes really global, you have to put the export statement in a file which will be sourced every time you start a new shell (usually .bashrc if using bash).
|
|
|
10-02-2007, 04:39 AM
|
#5
|
LQ Newbie
Registered: Oct 2007
Posts: 28
Original Poster
Rep:
|
colucix, lbdgwgt & kWzTa Thank you guys you were helpfull, but i found that my setting are not global. which bashrc file i should modify with export statement? & what line should change?
[root@localhost ~]# locate bashrc
/etc/bashrc
/etc/skel/.bashrc
/home/Mubarak/.bashrc
/root/.bashrc
/usr/share/doc/bash-3.2/startup-files/bashrc
statement
Thanks again guys
|
|
|
10-02-2007, 05:21 AM
|
#6
|
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509
|
If you want to define environment variables on a per-user basis, you should put export statements in .bashrc under user's home (e.g. /home/Mubarak/.bashrc from your list). If you want a system wide configuration, the better place is under the /etc/profile.d directory. Look at its content: you will find some .sh and .csh scripts. These contain environment settings from specific applications. You can create your own, for example a script called ns.sh.
Just for completeness, these scripts are sourced from /etc/profile, which - on my system - has the following relevant piece of code:
Code:
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
|
|
|
All times are GMT -5. The time now is 06:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|