LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-02-2007, 01:42 AM   #1
muby
LQ Newbie
 
Registered: Oct 2007
Posts: 28

Rep: Reputation: 15
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
 
Old 10-02-2007, 01:57 AM   #2
lbdgwgt
Member
 
Registered: Aug 2006
Distribution: Ubuntu
Posts: 87

Rep: Reputation: 15
use "echo" for example to see your new PATH:
Code:
# echo $PATH
using env you can do:
Code:
# env | grep PATH

HTH,
 
Old 10-02-2007, 02:38 AM   #3
kWzTa
LQ Newbie
 
Registered: Sep 2005
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
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,
 
Old 10-02-2007, 02:50 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
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).
 
Old 10-02-2007, 04:39 AM   #5
muby
LQ Newbie
 
Registered: Oct 2007
Posts: 28

Original Poster
Rep: Reputation: 15
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
 
Old 10-02-2007, 05:21 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984Reputation: 1984
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
 
  


Reply

Tags
environment, fedora 7, variables


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
setting environment variables v333k Linux - Newbie 5 06-27-2006 03:15 PM
Setting Environment Variables rbh123 Linux - Newbie 2 10-03-2005 06:34 PM
Setting Environment Variables farzan Linux - Newbie 2 08-07-2004 09:13 AM
setting environment variables durden2.0 Linux - Newbie 5 07-15-2003 01:57 PM
setting environment variables rezza Linux - Distributions 2 04-09-2003 08:21 AM

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

All times are GMT -5. The time now is 06:38 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