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

Re: setting Env variable, and in Debian



On Wed, Aug 28, 2002 at 07:39:19AM -0700, damar thapa wrote:
> I still have not figured out why env variables defined in /etc/profile
> do not show up.

Have you read the INVOCATION section in 'man bash'? /etc/profile is only
read by login shells.

I set environment variables in ~/.bashrc and make sure ~/.bash_profile
sources ~/.bashrc. Much simpler. (Although some people prefer to keep
those two files separate and have them both source some other file.
Whatever.)

> On top /etc/profile problem, I need to add one more (related) strange
> thing on that. I hope some one on the list can point me the problem.
> When I run "export JAVA_HOME=/usr/local/j2sdk1.4.1" on bash shell, it
> works (correct directory comes up on echo $JAVA_HOME, if I run this
> immediately).  But, after some some the variable vanishes on its own
> (some program that needs JAVA_HOME, starts to complain such as tomcat,
> and echo $JAVA_HOME, shows nothing too).  

I guess you started another shell in the meantime that wasn't a child
process of the one in which you exported the environment variable. The
shell doesn't forget about variables unless you unset it yourself or
source something that unsets it.

Cheers,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: