LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   adding a dir to PATH for root (https://www.linuxquestions.org/questions/linux-newbie-8/adding-a-dir-to-path-for-root-195671/)

Villain 06-20-2004 01:07 PM

adding a dir to PATH for root
 
probable an easy question

i created a directory in /sbin called script
i want to put scripts in it which root can execute, but users may not and dont have in their $PATH
how can i add the path, and being there on startup

i tried this in /etc/profile:

if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:/sbin/script:$PATH
fi
fi


doesnt work...

thanks for help

trickykid 06-20-2004 01:16 PM

You don't actually add /sbin/script in your path.. if the script resides in /sbin, just having /sbin in your path will find that executable, if you did make it executable.

Okay, I read it wrong, thought you made a script called script.. not a directory.

Well if you added it, did you export it after saving the profile file?

source /etc/profile

Will reread the file and make the changes in real time.. ;)

ranger_nemo 06-20-2004 01:16 PM

You can put it in /root/.bash_profile . Anytime you login as root, or use "su -", then it reads through the .bash_profile .

Villain 06-20-2004 03:49 PM

thx both worked

Well if you added it, did you export it after saving the profile file?
-no i didnt

why doesnt it reread the file on startup?
where is the profile content saved after it is reread?

No manual entry for source... :(


All times are GMT -5. The time now is 03:48 AM.