Results 1 to 8 of 8
I google the internet about how to set the path for my new program. Frankly, I feel confused. It seems that there are different methods, and I don't know which ...
- 04-19-2007 #1Just Joined!
- Join Date
- Nov 2006
- Posts
- 46
how to set path
I google the internet about how to set the path for my new program. Frankly, I feel confused. It seems that there are different methods, and I don't know which one to trust ( I don't want to damage my current settings).
Basically, what i want is to add the new program directories to the default search path. I prefer to use C-shell ( my default shell is bourne shell, i think, and i have to type csh to change to C shell). I looked my .cshrc file. It is pretty simple, only two sentences that I myself created for another program (under the instruction provided by that program). there is no word like "SETENV", "PATH". I don't know how to add the path for my new program. Do I have to be the root?
Can anyone suggest a general method? Thanks! ( I am using Suse 10.0)
- 04-19-2007 #2Just Joined!
- Join Date
- Mar 2007
- Location
- Newcastle, Australia
- Posts
- 80
Probably the easiest thing is to add you $PATH that you wish to speciy in your bashprofile. Your bashprofile is usually in your home dir so /home/user/.bashprofile so
would do it, Kate being my choice of editor.kate ~/.bash_profile
here is mine
As you can see I added python to mine.# .bash_profile
# Initialize keychain if needed
if [ -r $HOME/.ssh/identity -o -r $HOME/.ssh/id_dsa -o -r $HOME/.ssh/id_rsa ]; then
if [ ! -d $HOME/.keychain ]; then
keychain
fi
fi
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
PATH=$PATH:/home/flebber/Python
export PATH
unset USERNAME
Hope this helps
- 04-19-2007 #3Just Joined!
- Join Date
- Nov 2006
- Posts
- 46
Re:
Thanks. Are you doing this as user or root?
- 04-19-2007 #4Just Joined!
- Join Date
- Mar 2007
- Location
- Newcastle, Australia
- Posts
- 80
Yes no you need to work as root.
- 04-19-2007 #5
I think this article may help you out.
- 04-20-2007 #6Just Joined!
- Join Date
- Apr 2007
- Posts
- 2
If you want to have a system variable set (available to all users) then add what flebber suggested under /etc/profile (at the end of the file) and run as root:
source /etc/profile
Cheers
- 04-24-2007 #7Just Joined!
- Join Date
- Mar 2007
- Posts
- 3
yep, that's a good way to go about doing it.
- 04-25-2007 #8
littlewenwen:
Use one of the following lines in your '.cshrc' file (depending on where in the path you want your directories):
Also, you do not need to be root -- just edit your '.cshrc' file as a normal user...Code:set path = ( <*> $path ) set path = ( $path <*> ) <*> = "list of one or more paths separated by spaces"


Reply With Quote