adding some personal scripts to PATH with frugal


Forum: Other Help Topics
Topic: adding some personal scripts to PATH with frugal
started by: plinej

Posted by plinej on Jan. 02 2006,17:29
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?
Posted by mikshaw on Jan. 02 2006,18:00
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"

Posted by plinej on Jan. 02 2006,18:06
Thank you!
Posted by plinej on Jan. 02 2006,20:32
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?
Posted by mikshaw on Jan. 02 2006,21:49
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.

Posted by plinej on Jan. 02 2006,22:13
Thank you, I'll give it a try tonight.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.