You are not logged in.

#1 2003-12-02 15:52:17

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 770

environment variables

Where can I set these for system wide use?

Offline

#2 2003-12-02 17:43:03

chane
Member
Registered: 2003-12-02
Posts: 93

Re: environment variables

phunni wrote:

Where can I set these for system wide use?

Which shell are you using?  If you are using the /bin/bash shell, you can place an executable script file in /etc/profile.d with the commands you want executed (e.g., export a variable) and it will be run for every user.

What actually happens is the /bin/bash shell runs /etc/profile which then runs all of the script files in /etc/profile.d.

Hope that helps,
Chris....

Offline

#3 2003-12-02 20:05:37

phunni
Member
From: Bristol, UK
Registered: 2003-08-13
Posts: 770

Re: environment variables

This doesn't seem to be working - I have an executable script in /etc/profile.d/ with:

export JAVA_HOME=/home/paul/Java/j2sdk1.4.2_02/
export PATH=$PATH:/home/paul/bin:$JAVA_HOME/bin

in it - but this does not seem to be run on login...

Offline

#4 2003-12-02 20:24:34

andy
Member
From: Germany
Registered: 2002-10-11
Posts: 374

Re: environment variables

Two things :
1. the file in /etc/profile.d must end in .sh and be executable
2. don't put something in the system wide configuration that depends on a user directory. (That's arguable, though). Instead put it in ~/.bash_profile or ~/.bashrc
The contents and use of ~/.bash_profile, ~/.bashrc and also ~/.profile can be confusing. For a clean bash setup don't use ~/.profile.
The default Arch setup seems to be to essentially use .bashrc only. That is arguable, too. Read the man page to bash and search for FILES at the bottom and for INVOCATION.
Something else that is always forgotten : when you open an xterm, gnome-term or whatever, you can make it either a login-shell or not. And depending on that, the various startup file are executed or not (I tend to make all terminals login-shells).

Offline

Board footer

Powered by FluxBB