Referencing environment variables *in* /etc/environment?
Posted
by
Stefan Kendall
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Stefan Kendall
Published on 2011-11-13T16:38:00Z
Indexed on
2011/11/13
18:06 UTC
Read the original article
Hit count: 563
configuration
|environment-variables
I recently discovered /etc/environment
, which seems a more standard way to setup simple environment variables than scripts, but I was wondering if there was a way to back-reference environment variables in the /etc/environment file.
That is, I have this:
JAVA_HOME="/tools/java"
GRAILS_HOME="/tools/grails"
GROOVY_HOME="/tools/groovy"
GRADLE_HOME="/tools/gradle"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
If I try to add $JAVA_HOME/bin
to the PATH definition, however, I get $JAVA_HOME/bin, and not the interpolated variable. To remedy this, I'm creating environment.sh in profile.d to add the /bin
entries to the path, but this seems sloppy and disorganized.
Is there a way to backreference the environment variables in /etc/environment?
© Ask Ubuntu or respective owner