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)

leohart 2009-02-07 15:07

where to add new dirs to PATH?
 
hi,the /sbin is not in PATH on N810, so I cannot use command like ifconfig, I've tried vi .bashrc in my home dir, but it doesnt work(the .bashrc is not sourced automatically when bash2 startup)
so what should I do next?

ps: I have installed bash2, and it always shows full path before the prompt, this is really annoying when the path is very long, how can I make only the last dir is shown like a normal shell always does?
THX

qwerty12 2009-02-07 15:16

Re: where to add new dirs to PATH?
 
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 :)

free 2009-02-07 15:29

Re: where to add new dirs to PATH?
 
Read man bash, section INVOCATION:

* bashrc is not sourced for interactive login shells, only for non-login shells
* profile is source for interfactive login shells


As everything inherits from login shells, the place for $PATH setting is in a profile file (/etc/profile, /etc/bash_profile or ~/.profile, ~/.bash_profile)

Then some distributions do not follow this, they source .bashrc within .profile but it's not a general rule.

free 2009-02-07 15:32

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

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

Hi qwerty12!

I guess you meant

echo "PATH=/sbin:$PATH" >> ~/.profile

leohart 2009-02-07 15:41

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

Originally Posted by free (Post 262770)
Read man bash, section INVOCATION:

* bashrc is not sourced for interactive login shells, only for non-login shells
* profile is source for interfactive login shells


As everything inherits from login shells, the place for $PATH setting is in a profile file (/etc/profile, /etc/bash_profile or ~/.profile, ~/.bash_profile)

Then some distributions do not follow this, they source .bashrc within .profile but it's not a general rule.

I just used to edit .bashrc under centos and it works fine ,so I dont know these stuff...
but I didnt login when I opened a xterminal, why it is a interactive login shell?

leohart 2009-02-07 15:50

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

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

^ should work.

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

thank you so much:)

free 2009-02-07 15:55

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

Originally Posted by leohart (Post 262776)
I just used to edit .bashrc under centos and it works fine ,so I dont know these stuff...
but I didnt login when I opened a xterminal, why it is a interactive login shell?

That's what I said, some distro do their internal cooking, when you change distro, it does not work anymore.
Why I use debian on all my machines..

When you open a terminal, it has inherited the variable PATH from the login shell.

free 2009-02-07 15:57

Re: where to add new dirs to PATH?
 
Put this in bashrc and open a terminal, open another one within this one.
Look at your PATH, it contains two times /sbin
;)

leohart 2009-02-07 16:18

Re: where to add new dirs to PATH?
 
excuse me ,just curious,how can I open another terminal within a terminal?
tried osso-xterm but it doesnt work...

free 2009-02-07 16:57

Re: where to add new dirs to PATH?
 
Sorry, I was talking in general on unix/linux machines.

I don't know for the device. BUt you can can open a new tab.


All times are GMT. The time now is 00:59.

vBulletin® Version 3.8.8