LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-20-2004, 01:07 PM   #1
Villain
LQ Newbie
 
Registered: Jan 2004
Location: Munich,Germany
Distribution: Slackware 10 - 2.6.7
Posts: 25

Rep: Reputation: 15
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
 
Old 06-20-2004, 01:16 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
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..

Last edited by trickykid; 06-20-2004 at 01:21 PM.
 
Old 06-20-2004, 01:16 PM   #3
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
You can put it in /root/.bash_profile . Anytime you login as root, or use "su -", then it reads through the .bash_profile .
 
Old 06-20-2004, 03:49 PM   #4
Villain
LQ Newbie
 
Registered: Jan 2004
Location: Munich,Germany
Distribution: Slackware 10 - 2.6.7
Posts: 25

Original Poster
Rep: Reputation: 15
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...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Java to root users PATH? infornography Linux - Newbie 5 05-26-2005 07:49 AM
Changing home dir path? NonSumPisces Linux - Newbie 4 08-22-2004 04:16 PM
Adding to Path for root in Suse stefarg Linux - General 1 04-21-2004 05:58 PM
Adding a dir to PKG_CONFIG_PATH bhodi Linux - Newbie 1 11-19-2003 01:54 PM
cant resize root thru rescue, auto mounts root dir absolutal Linux - Newbie 0 06-18-2003 03:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration