View Full Version : Correct way to set environment variables at startup

13th September 2006, 08:01 AM

I would like to know what's the "best" way to set "global" environment variables at startup. Should i put the "export XYZ=value" into rc.local? Or is there a global configuration file for the bash?

Thanks in advance,

13th September 2006, 09:40 AM
There are no global environment variables in Linux. Each process has its own environment whose initial values are inherited from the parent process. Any exports you make in rc.local have effect only in programs started from rc.local.
Bash sources the /etc/profile file when a login shell is started, put your own variable settings to a file in /etc/profile.d and it will be included.