Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ [1] 2 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: adding some personal scripts to PATH with frugal< Next Oldest | Next Newest >
plinej Offline





Group: Members
Posts: 75
Joined: Oct. 2005
Posted: Jan. 02 2006,17:29 QUOTE

I'm running a frugal install of DSL 1.5 (can't run anything beyond that since the new ndiswrapper seems to freeze up the system). I created a bin directory with several of my personal scripts at /home/dsl/bin/. How can I add that directory to my PATH so I can run my scripts from any directory?
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 02 2006,18:00 QUOTE

Add this command to /home/dsl/.bash_profile (make sure it is not *after* the "startx" part) and make sure the file is backed up:

Code Sample
export PATH="$HOME/bin:$PATH"


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
plinej Offline





Group: Members
Posts: 75
Joined: Oct. 2005
Posted: Jan. 02 2006,18:06 QUOTE

Thank you!
Back to top
Profile PM 
plinej Offline





Group: Members
Posts: 75
Joined: Oct. 2005
Posted: Jan. 02 2006,20:32 QUOTE

Works great for my scripts I can run as user dsl but is there a way for root to be able to run the scripts in that path?
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 02 2006,21:49 QUOTE

The PATH variable, like any environment variable, is unique to each user.  In order for user2 to have the same directory in PATH that user1 has, user2 will need to do the same that user1 did....namely modify his PATH variable to include another directory.

Keep in mind that "$HOME" for root is not the same as $HOME for dsl, so root will have to use the command with a full path:
Code Sample
export PATH="$PATH:/home/dsl/bin"


Notice here that I also switched the new directory to the end of root's PATH instead of the beginning.  This is just a precaution...if there was an executable in that directory with the same name as something root needs in /sbin or /usr/sbin, things could get messy.

I typically add $HOME/bin to the beginning of dsl's PATH for exactly the opposite reason.  I want to be able to override system executables with my own.  This lets dsl use custom versions of (most) system-wide apps without preventing other users from having the defaults.

EDIT:  Also note that root's personal files cannot be restored with the backup/restore system (no write permission to /root for dsl), but you ca probably put that command in another startup file run by root, such as /opt/bootlocal.sh.  I can't say for sure that it will work though, since i've never tried modifying environment from a boot script.  If it doesn't work, you can put this in bootlocal:
Code Sample
echo 'export PATH="$PATH:/home/dsl/bin"' >> /root/.bashrc

That's single quotes surrounding the echo so it will echo literally.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
5 replies since Jan. 02 2006,17:29 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: adding some personal scripts to PATH with frugal

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code