Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a problem. I have set an environment variable in /etc/environment using BOOST_LIBRARYDIR="/usr/local/lib/boost/release".

echo $BOOST_LIBRARYDIR correctly echoes the value to the terminal. However, if I execute echo $BOOST_LIBRARYDIR in a script using ./ it shows the env variable as empty. As I understand it, it should be set also for child processes?

share|improve this question
up vote 3 down vote accepted

If you want an environment variable to be passed to children you must export it. To verify if it is exported use the env command. The safest way to do this is as follows.

BOOST_LIBRARYDIR="/usr/local/lib/boost/release"; export BOOST_LIBRARYDIR

Newer shells like bash and ksh accept the simpler form.

export BOOST_LIBRARYDIR ="/usr/local/lib/boost/release"
share|improve this answer

Since /etc/environment seems to be sourced from /etc/init/gdm.conf, I think you can substitute your line with

export BOOST_LIBRARYDIR="/usr/local/lib/boost/release"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.