Java Mailing List Archive

http://www.redhatconfig.com/

Home » Ubuntu Technical Support »

Re: /etc/environment, variables aren't expanded

Cameron Hutchison

2008-05-16

Replies:

Author LoginPost Reply
TomasN <nechtom@(protected):

>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.

>JAVA_HOME="/opt/jdk1.6.0_06"
>JDK_HOME="$JAVA_HOME"
>JRE_HOME="$JDK_HOME/jre"
>PATH="$JDK_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

>... 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.

.

--
ubuntu-users mailing list
ubuntu-users@(protected)
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
©2008 redhatconfig.com - Jax Systems, LLC, U.S.A.