Add to $PATH how?

Cameron Simpson cs at zip.com.au
Wed Jun 7 12:46:40 UTC 2006


On 06Jun2006 08:54, Steven W. Orr <steveo at syslang.net> wrote:
| Be aware that ssh starts a login shell except if you are running a 
| specific command. e.g., ssh foo is a login shell, but ssh foo pwd is not. 
| So the correct thing to do is to set your PATH in you .bash_profile and to 
| also set it in your .bashrc IF YOU ARE NOT INTERACTIVE. Test if you're 
| interactive in your .bashrc by looking if $PS1 is null.
| 
| if [[ -z "$PS1" ]]
| then
| 	# Set aliases here
| else
| 	# Set PATH here
| fi

God, NO.

That's what the RedHat bashrc do. It's very wrong. Test for an "i" in
the $- variable. People used to just set $PS1 and export it. Worked just
fine - happened in your .profile and all was good.

I had to _stop_ doing that because the idiots at RedHat expect $PS1 to
be set only in interactive shells (circularly, because they expect it to
be set in the bashrc...). It is false logic, and routinely trashed my
setups.

Test $-, and ignore $PS1.

Of course, one of the first things we do in our standard installs at
work is to discard the /etc/bashrc supplied by RH completely. It's
very dodgy.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Top executives cannot afford to be isolated from the people below, who are in
better touch with what is going on, and cannot afford to set unrealistic
goals.  - Charles Burck




More information about the fedora-list mailing list