Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am installing Apache Maven 3.1 on Ubuntu Desktop 10.04.

The installation page http://maven.apache.org/download.cgi#Installation, 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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.