/etc/environment, variables aren't expanded

Cameron Hutchison lists at xdna.net
Sat May 17 02:47:26 UTC 2008

TomasN <nechtom at gmail.com> writes:

>Hi. Why the environment variables in /etc/environment aren't expaned?

Because /etc/environment is not a shell script. It is the shell that
does expansion of environment variables. The PAM module pam_env is what
reads /etc/environment - and it treats it as a simple list of KEY=VAL
pairs and sets up the environment accordingly. It has no language for
doing variable expansion.


>... in /etc/profile each variable in quotes is expanded.

/etc/profile is a shell script, and as such it has access to the full
facilities of the shell.

I personally think /etc/environment is rather useless for the reasons
you've just found. It is too simplistic to just have KEY=VAL lines is a
lot of cases.

Just use /etc/profile instead of /etc/environment. That's what I do.


More information about the ubuntu-users mailing list