maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N810 (https://talk.maemo.org/forumdisplay.php?f=28)
-   -   where to add new dirs to PATH? (https://talk.maemo.org/showthread.php?t=26696)

statwrangler 2010-01-05 18:20

Re: where to add new dirs to PATH?
 
Quote:

Originally Posted by qwerty12 (Post 262766)
echo "PATH=/sbin:$PATH" >> ~/.profile

^ should work.

As for your second question, look at the file /etc/profile.d/prompt.sh and google bash PS1.

Corrected thanks to free here:
http://www.internettablettalk.com/fo...73&postcount=4 :)

For those searching for "N900 $PATH", I add: After much reading and some courage I added "/home/user/bin" using the above. (((There was no /home/user/.profile so I created it with text: "PATH = $PATH:/user/home/bin"))). It works. I can now safely run some little shell scripts (stored in /home/user/bin which I created for this purpose) as user. Thanks querty12.

fatalsaint 2010-01-05 18:27

Re: where to add new dirs to PATH?
 
Just because I'm on of those attention to detail idiots...

You'll notice in qwerty's he put the added path before the $PATH:
Code:

/sbin:$PATH
And you put yours after the $PATH:
Code:

$PATH:/user/home/bin
99.99% of the time this will never matter. However, that IS order sensitive... if you have two applications on the system with the same name in two different paths, the first one it comes to in your $PATH variable will be the one executed. So, just for example, you write a wrapper for VI or something that enables colors or uses VIM or other command line options and store it as "vi".. put it in ~/bin and then put that after $PATH.. it'll never run.

Like I said... 99.99% of the time it'll never matter.. but there can be uses for understanding this.

statwrangler 2010-01-05 20:00

Re: where to add new dirs to PATH?
 
You are right that the order matters. My choice of after was deliberate. I can always change the name of my script (e.g. myvi). I will know immediately if I have picked a name used by the shell. But if I put my bin first, I might pick a common name and much later find that the standard procedure was not available -- and having forgotten my script, be puzzled. De gustibus ....


All times are GMT. The time now is 15:28.

vBulletin® Version 3.8.8