[NTLUG:Discuss] $PATH=what??!
Kevin Brannen
kbrannen at gte.net
Sat Nov 20 00:52:34 CST 1999
Cameron,
Comments & explanations embedded...
Cameron wrote:
>
> i've got a problem that's bugging the pooh out of me. i'm trying to run
> a remote command with ssh that it NOT is the systems default $PATH.
> here's what i've found so far ("/snip" means i cut some stuff out):
>
> $ ssh bravo2 set
> (/snip)
> PATH=/usr/bin:/bin:/usr/local/bin
> SHELL=/bin/bash
This executes on the remote machine, so that is what you really have
there.
>
> $ ssh bravo2 echo $PATH
> /bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/lam-6.3/bin
Please consider _WHO_ expands $PATH here. If you said ``your shell on
the *local* machine'', take the gold star. :-)
>
> $ ssh bravo2 "set ; echo $PATH ; set"
> (/snip)
> PATH=/usr/bin:/bin:/usr/local/bin
> (/snip)
> /bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/local/lam-6.3/bin
> (/snip)
> PATH=/usr/bin:/bin:/usr/local/bin
Same thing. The $PATH is only in double quotes, so your local shell
expands it, then passes that to ssh, who obediently gives it back to
you.
>
> you'll notice that `set` and `echo $PATH` yield different values no
> matter how you turn it. the context in which i need to do this (using
> LAM/MPI) doesn't make the "export..." stuff very appealing. and that
> last command really confuses the heck out of me. anyway, to the heart
> of my problem: where can i set the default, system-wide,
> shell-independent(?) $PATH? i'm running Mandrake 6.1. i've looked
> through /etc/rc.d/ but no luck. btw, in /etc/profile the path gets set
> to "$PATH:/usr/X11R6/bin", so i know it's not effecting anything.
>
> well, bash gurus...it's time to step forward. i'm at my wits end. any
> help would be greatly appreciated. TIA
No guru'ness needed, just experience. :-) Do "man bash" and read the
part on quoting very carefully; especially the part that starts:
Enclosing characters in double quotes preserves the lit
eral value of all characters within the quotes, with the
exception of ...
And I'll leave you hanging so you'll read that paragraph and at least
the 4 above it. :-) Or, just look over the entire section labeled
"QUOTING".
HTH,
Kevin
More information about the Discuss
mailing list