2

I want to add /home/myname/adt-bundle-linux-x86_64-20130219/eclipse to PATH.

I edited .profile:

PATH="$HOME/bin:$PATH:/home/myname/adt-bundle-linux-x86_64-20130219/eclipse"

but it won't work. Why?

When I instead save export PATH=/home/myname/adt-bundle-linux-x86_64-20130219/eclipse:$PATH in a file in /etc/profile.d/ and do chmod a+x it works.

Both should work. I would like to understand why the first option does not work.

3
  • 1
    Have you tried adding export to .profile as well?
    – choroba
    Apr 29, 2013 at 15:47
  • Yes I tried that but it did not work.
    – Running24
    Apr 29, 2013 at 16:23
  • Actually, some clarification required: what "doesn't work"? Does the new directory fail to appear in $PATH? Apr 29, 2013 at 19:15

1 Answer 1

0

Is /home/myname/adt-bundle-linux-x86_64-20130219/eclipse a directory or actually the program you want to execute? If the latter, your .profile should contain

PATH="$HOME/bin:$PATH:$HOME/adt-bundle-linux-x86_64-20130219"
5
  • No the program I want to run, eclipse, is in the directory home/myname/adt-bundle-linux-x86_64-20130219/eclipse
    – Running24
    Apr 29, 2013 at 16:22
  • 1
    After you edited ~/.profile, did you re-source it? . ~/.profile Apr 29, 2013 at 16:23
  • Also, do you have a ~/.bash_profile file? If you do, bash won't read ~/.profile -- gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files Apr 29, 2013 at 16:25
  • No I do't have a ~/.bash_profile, and yes I did source it after editing.
    – Running24
    Apr 29, 2013 at 19:01
  • Oh I am so embarrassed! Thanks Glenn for you effort!!! I can't even vote you up cos I am new. It works exactly liked you wrote, and I had done it like that, except that I added the new path between if and fe and since I do not have a /bin directory in my home directory I could wait forever that my path will be exported.
    – Running24
    Apr 29, 2013 at 21:05

You must log in to answer this question.

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