[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: environment variable



On Wed, 12 Feb 2003, Mike Vanecek wrote:

=>
=>---------- Original Message -----------
=>From: Joe Klemmer <klemmerj webtrek com>
=>To: psyche-list redhat com
=>Sent: 10 Feb 2003 17:48:48 -0500
=>Subject: Re: environment variable
=>
=>> On Mon, 2003-02-10 at 17:36, Jerry Roy wrote:
=>> 
=>> > How do I permanently set an environment variable so it works across
=>reboots? I have the command down, just don't know which is the correct file
=>(.bashrc? .profile?) to place it in. Someone said there is a "Better" way.
=>Please offer suggestions on writing the command.
=>> > 
=>> > set $ICAClient:/test/icadir
=>> > export $ICAClient
=>> 
=>> 	If you only need this for your login put it in $HOME/.bash_profile. 
=>> But if it's needed by the system for every login you should put it in
=>> /etc/profile.
=>------- End of Original Message -------
=>
=>When should one use /etc/bashrc as opposed to /etc/profile?  Not always sure
=>which one in which to put system wide changes.

The .bash_profile runs when you first log in. It then sucks in the 
.bashrc. The .bashrc is sucked in automatically by subshells. So the 
answer is to put all of your environment variable definitions in the 
.bash_profile so they can be inherited by all of the subprocesses. The one 
exception to the rule is if you need to use rsh. Then be aware that remote 
jobs do *not* go through the .bash_profile and instead jut use the 
.bashrc. So what's a girl to do? Simple: Just check in your .bashrc to see 
if you're interactive by seeing if your PS1 variable is no set. If it is 
not set then just source in your section of your .bash_profile that sets 
those variable. 

Is that clear?

-- 
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question?
steveo at syslang.net






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]