Hi...two newbie questions:
1,How do I add a dir to my $PATH?
2,Are there any security issues with adding /usr/local/sbin to my path? Is only root allowed to install there?
Thanks yet again,
Ming.
bdg1983
06-22-2001, 02:12 PM
The following is from the Bash Configuration NHF available right here at Linuxnewbie.
PATH
The first thing to configure is the PATH variable. PATH defines the directories that you have
direct access to. For example; if you have a program called foo in /bin and you want to
run it. If /bin is in your PATH, then all you have to do is to type foo anywhere and the
program would run. If /bin was not in your PATH, you would have to type the full path
name to program foo in order to run it, that is: /bin/foo. This variable is located in
/etc/profile, and it has an unusual syntax. Each directory on the right hand side of
the equation has to be seperated by a colon: ":". Eg:
PATH=/bin:/usr/bin:/usr/local/bin
export PATH
In the above example, three directories, /bin, /usr/bin, and /usr/local/bin are
seperarated by a colon. When creating a new PATH variable, it is important to add the
current PATH variable to the new PATH variable. Eg:
PATH=$PATH:/usr/games
export PATH
This appends /usr/games into the already existing PATH variable, which is $PATH. Recall that
a variable prefixed with a dollar sign is expanded to its original value. In this case, $PATH is
expanded to /bin:/usr/bin:/usr/local/bin. Because it is added to the new PATH variable,
the new PATH variable can now be expanded to /bin:/usr/bin:/usr/local/bin:/usr/games.
If you had omitted $PATH in the definition, then PATH would be expaned to /usr/games. If
you are not root, you may add to and modify your current existing PATH in ~/.bash_profile.