Click to See Complete Forum and Search --> : PATH Environment Variable - Confusing
Dark Ninja
10-09-2001, 09:21 PM
Okay - I've got the hang of a lot of the Linux thing, but, I'm still confused about one thing. The $PATH variable. How and where do I edit it at? I edit /etc/profile, but, even if I reboot my system, it doesn't seem to want to work. And, I've tried editing ~/.bash_profile and that doesn't seem to work either.
Does anybody have some good documentation, or can you give me information on how to add a directory to my PATH without me having to jump through hoops to do it every time?
Thank you.
Dark Ninja
Nekopa
10-09-2001, 09:41 PM
Taken from Linux For Dummies (Crap book, but it had CDs :D )
to add the directory /home/ralph/scripts to the end of the search path type PATH=$PATH:/home/ralph/scripts The $PATH in this case adds to the original contents.
HTH
Lee
Dark Ninja
10-09-2001, 09:49 PM
YES. Thank you Nekopa. I don't know why I could never find that information before, but, it works perfectly now. (Even when I log out and log back in.)
Thank you.
Dark Ninja
(RATING FOR REPLY: 5 Stars) ;)
Dark Ninja
10-09-2001, 10:45 PM
Sheiss...nevermind. I reboot, and I have to enter the path variable again. How do I make it stay there PERMANENTLY? This is so annoying.
Dark Ninja
Linuxcool
10-09-2001, 10:50 PM
The ~/.bashrc file might be the one that you edit.
X_console
10-09-2001, 10:50 PM
What shell are you using? I believe /etc/profile is only used by bash. If you're using bash, then it should load /etc/profile first, and then ~/.bash_profile and ~/.bashrc Anytime you make any changes, you do not have to reboot. Just use the "source" command. Eg:
source /etc/profile
This will reread the /etc/profile and make the proper changes the the environmental variables.
To add a new entry to PATH, you do this:
PATH=$PATH:/new/path:/another/new/path
export PATH
You put that either in your /etc/profile or your .bash_profile, and then you source it.
scanez
10-09-2001, 11:17 PM
If your using csh or tcsh, edit your .login file to say
set path = ($path path_to_directory_you_want_to_add)
or if that doesn't work
set PATH=directory_to_add;$PATH
Good luck
SC
Dark Ninja
10-09-2001, 11:35 PM
Tried both. (I'm using BASH, BTW) - Still won't work. I'm going crazy now. Even the 'source' command doesn't work.
Dark Ninja
X_console
10-10-2001, 12:03 AM
Ok, forgive me for asking the obvious questions...
1. You are root right?
2. You do save the changes you've made to the files right?
3. What errors, if any, do you get when you type "source /etc/profile"?
4. What do you get when you type "echo $SHELL"
5. You sure you're not in a restricted shell?
Dark Ninja
10-10-2001, 06:03 PM
1. Yes, I am root.
2. If I 'export PATH' after I set PATH= that should save the changes, correct? (I want these changes to apply to the whole system - every user.)
3. No errors.
4. /bin/bash
5. It's my own system - I don't think it's restricted.
Still haven't been able to get this whole PATH thing to stay permanently. I've learned about a lot of other things while reading, however. Thanks for all the help on this. If I can understand this PATH thing, I'll be a happy person.
Dark Ninja