Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

problem with /etc/profiles

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
hasc
Posts: 1
Joined: 2005-05-09 11:13

problem with /etc/profiles

#1 Post by hasc »

i added the following lines to the /etc/profiles file:

export JAVA_HOME="/usr/lib/java"
and added the $JAVA_HOME/bin to the PATH variable.

When i execute "echo $PATH" or "echo $JAVA_HOME" the values are not set. I restarted the computer after the changes. Executing the commands manually in the bash worls fine though.
Its propably a beginners problem but i searched in this forum and didn't find anything appropriate. So help would be great.

Thanks,
hasc

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

/etc/profile is sourced only from a "login shell", e.g. when you log in to get your shell. Graphical display mangers tend not to behave as a login shell, thus they aren't source /etc/profile. You may add the

Code: Select all

. /etc/profile
line to your ~/.bashrc to get /etc/profile sourced when you start an xterm or something similar.

sprucio
Posts: 143
Joined: 2005-03-29 03:30

#3 Post by sprucio »

Where does bash get it's env variables when not using a login shell?

Jeroen
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 483
Joined: 2004-04-06 18:19
Location: Utrecht, NL
Contact:

#4 Post by Jeroen »

just from the parent process then: environment variables are inherited.

sprucio
Posts: 143
Joined: 2005-03-29 03:30

#5 Post by sprucio »

Can you tell me where the parent shell gets it from?

Jeroen
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 483
Joined: 2004-04-06 18:19
Location: Utrecht, NL
Contact:

#6 Post by Jeroen »

ultimately from either some login shell, or from your login method: If you login via ssh, ssh sets a few variables, possibly with use of /etc/environment and/or PAM (which in turn uses /etc/environment). If you use getty for console logins, that program is involved, similarly if you use gdm/kdm/xdm.

Try 'ps aux -H > processlist' and open the file processlist in some editor of choice to see a bit the hierarchy of processes. In my case, this mozilla process I'm typing in is launced from ion2, my window manager, which is in turn launched from gdm, my graphical login program.

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#7 Post by lacek »

Also, if bash is not a login shell, it sources ~/.bashrc. That's where you can put your exports for xterms and similar.

rezza
Posts: 1
Joined: 2004-11-02 02:41
Location: Edinburgh, UK

#8 Post by rezza »

Also note that it's /etc/profile, not /etc/profiles ;)

Post Reply