[NTLUG:Discuss] $PATH=what??!

Cameron hrothgar at endor.hsutx.edu
Sat Nov 20 01:08:28 CST 1999


* kbrannen at gte.net [1999.11.20 00:53]:
: 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
: 

Kevin,

thanks for pointing that out to me.  i hate it when it's something like
that; i should have noticed that.  anyway, for those interested here's
the revised command that was making me crazy earlier:

  $ ssh bravo2 "set ; echo \$PATH ; set"

BUT (and if i could make that but bigger i would) my main problem still
remains.  how can i change the default path for my system (or just
bash)?  it defaults to "/usr/bin:/bin:/usr/local/bin".  i've about
decided it's set in the bash binary because i can't find it anywhere.
any more pointers would be greatly appreciated.  thnx
-- 
cameron
  [ Grow up and use mutt (http://www.mutt.org) ]




More information about the Discuss mailing list