Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I refer to help.ubuntu.com to set environment variables.

I'm required to set some variables (GRIFFON_HOME and GROOVY_HOME) for a user and also I want to include bin folders to my PATH so I edited ~/.pam_environment as follows.

LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
PAPERSIZE=letter
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
GRIFFON_HOME=/opt/griffon
GROOVY_HOME=/opt/groovy
PATH=$PATH:$GRIFFON_HOME/bin:$GROOVY_HOME/bin

and I executed following command

source ~/.pam_environment

After this, both griffon and groovy commands are included in my PATH but after I exit that terminal and reopen another terminal and try to execute groovy or griffon, both commands are not included in my PATH. But I've found that the variable GROOVY_HOME and GRIFFON_HOME are still set.

How can I have my PATH to include the bin folders permanently?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Put PATH=$PATH:$GRIFFON_HOME/bin:$GROOVY_HOME/bin in your ~/.bash_profile file instead of the ~/.pam_environment file.

Alternatively you can add the following to your ~/.bash_profile file:

if [ -f ~/.pam_environment ]; then
   source ~/.pam_environment
fi
share|improve this answer
    
~/.bash_profile doesn't exist but I have put PATH=$PATH:$GROOVY_HOME/bin:$GRIFFON_HOME/bin into my ~/.profile and is working fine. Is there any difference between setting up in .bash_profile and .profile? Also .profile and .bash_profile is set to not recommended in help.ubuntu.com to set environment variables. –  TheKojuEffect May 11 '13 at 13:13
1  
The first shells used a .profile file to load the environment for the user, bash will read the .profile file if a .bash_profile file doesn't exist to maintain backwards compatibility. I do not know the help article recommends not setting environment variables in either the .profile or .bash_profile files. Unless this is something new for 13.04. On my system the default .profile file that is provided to users by Ubuntu has path information in it. –  notkevin May 11 '13 at 16:49

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.