Is it valid to have "pointers" in /etc/environment using $FOO syntax? Right now my /etc/environment looks like this:
JAVA_HOME=/usr/lib/jvm/java-6-openjdk
MAVEN_HOME=/usr/bin/apache-maven/apache-maven-3.0.4
M2_HOME=$MAVEN_HOME
M2=$MAVEN_HOME/bin
PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME/bin:$MAVEN_HOME/bin
I'm not getting the results that I'm expecting though:
~$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk
~$ echo $MAVEN_HOME
/usr/bin/apache-maven/apache-maven-3.0.4
~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin/bin:/usr/games:$JAVA_HOME/bin:$MAVEN_HOME/bin
"Environment variable settings that affect the system as a whole (rather then just a particular user) should not be placed in any of the many system-level scripts that get executed when the system or the desktop session are loaded, but into /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings."
Is that guidance incorrect?
– Tyson Trautmann Jun 12 '12 at 16:12/etc/profile.d
would be the place to put it, as it's designed so you can drop a separate file with your variables, thus you're not even modifying existing config files, so your changes should survive through upgrades. – roadmr Jun 12 '12 at 18:56/etc/bash.bashrc
. Has this file been moved somewhere else for ubuntu or is the only rc file loaded in bash on ubuntu the~/.bashrc
? – kapad Feb 12 '18 at 17:20