LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to add a directory to PATH? (https://www.linuxquestions.org/questions/linux-general-1/how-to-add-a-directory-to-path-858692/)

wolfv 01-25-2011 11:28 PM

How to add a directory to PATH?
 
I carefully followed instructions on how to add a directory to PATH, but it's not working.
I export PATH from .bash_profile in my home directory, but when I rebooted, nothing was added to PATH.

Code:

~$ pwd
/home/wolf
~$ echo $SHELL
/bin/bash
~$ more .bash_profile
export PATH=$PATH:/home/wolf/.gem/ruby/1.8/bin
~/rspec/hello/spec$ printenv PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

When I add the same directory from the terminal, it works (until the session ends):

Code:

~$ export PATH=$PATH:/home/wolf/.gem/ruby/1.8/bin
~$ printenv PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/wolf/.gem/ruby/1.8/bin

How to have a directory in PATH every time I boot?
I am running Ubuntu 10.4

Thank you

crts 01-25-2011 11:59 PM

Hi,

try adding it in your .bashrc instead of .bash_profile. Do not forget to source it afterwards.

wolfv 01-26-2011 07:27 PM

Thanks crts, that worked!


All times are GMT -5. The time now is 01:41 AM.