[NCLUG] /etc/environment
Tim Swanson
swanson at CS.ColoState.EDU
Sun Aug 19 00:38:14 MDT 2007
I'm having some trouble with environment variables. It could be that my
problem is unsolvable, but I'm not sure.
I'm trying to create a set of shared (all users) environment variables to
locate my various software packages. I want to use the value of
previously-defined variables in the new ones. For example:
DEVELOPMENT_HOME=/usr/local/development
JAVA_PROJECT_HOME=$DEVELOPMENT_HOME/Java/projects
I started by editing the /etc/bash.bashrc file. That worked fine once I
remembered to add "export". However, once I tried using the variables outside
a terminal environment, they were no longer there. So in apps launched from
the desktop environment, for example, I couldn't refer to them.
Some Googling convinced me that I needed to move the definitions to the
/etc/environment file. That worked, but when I put the definitions in as
above, the environment variables don't get recursively resolved. So I have
this problem:
$ echo $DEVELOPMENT_HOME
/usr/local/development
$ echo $JAVA_PROJECT_HOME
$DEVELOPMENT_HOME/Java/projects
$ cd $JAVA_PROJECT_HOME
bash: cd: $DEVELOPMENT_HOME/Java/projects: No such file or directory
Can I do what I'm trying to do, or do I just have to define my environment
variables without using other environment variables? Why does this work in
/etc/bash.bashrc but not in /etc/environment?
Thanks,
Tim Swanson
More information about the NCLUG
mailing list