Super User is a question and answer site for computer enthusiasts and power users. 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 am installing Apache Maven 3.1 on Ubuntu Desktop 10.04.

The installation page, in the section "Unix-based Operating Systems", states to export several variables:

export M2_HOME=/home/hduser/workspace/apache-maven-3.1.0
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

When I logout, and later login, I will lose those variables. So wouldnt it make more sense to set those variables in .profile so that when I later login I will still have those variables set? Why doesnt the instruction page state that, or are they expecting I will have the common sense to do that on my own?

share|improve this question
up vote 1 down vote accepted

export just makes the variables survive when another shell is called. A typical situation where another shell is called is when you invoke a script.

You'll definitely want to copy all those export statements in your .profile so that not only are they there when you login, but also exist in any subshells you may spawn through executing scripts and such.

I'd say this is a basic Unix thing.

Look at your current .profile - you'll likely already see an export PATH= statement in it.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .