PATH set by "rsh localhost echo \$PATH"

PATH set by "rsh localhost echo \$PATH"

Post by Trond Norby » Tue, 27 Jul 1999 04:00:00



When I try: rsh localhost echo \$PATH
I always get "/usr/bin:", but if I try:
rsh localhost
echo $PATH
I get the path I expected

Could someone _please_ tell me how I can modify the path in the first
example?

Trond Norbye

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Steve Bellen » Tue, 27 Jul 1999 04:00:00




Quote:

>When I try: rsh localhost echo \$PATH
>I always get "/usr/bin:", but if I try:
>rsh localhost
>echo $PATH
>I get the path I expected

>Could someone _please_ tell me how I can modify the path in the first
>example?

For ksh you could do
rsh localhost "(PATH=\$PATH/usr/local/bin ; export PATH ; echo \$PATH)"

I leave the csh details as an exercise.

--


 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Trond Norby » Tue, 27 Jul 1999 04:00:00




> For ksh you could do
> rsh localhost "(PATH=\$PATH/usr/local/bin ; export PATH ; echo \$PATH)"

> I leave the csh details as an exercise.

Well.... My problem was not only to display another path... I would like
my rsh-command to execute with another path...

so I can be able to: "rsh somwhere type dmake"

Trond Norbye

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Steve Bellen » Tue, 27 Jul 1999 04:00:00






>> For ksh you could do
>> rsh localhost "(PATH=\$PATH/usr/local/bin ; export PATH ; echo \$PATH)"

>> I leave the csh details as an exercise.

>Well.... My problem was not only to display another path... I would like
>my rsh-command to execute with another path...

>so I can be able to: "rsh somwhere type dmake"

So why not?
rsh somewhere "(PATH=\$PATH/usr/local/bin ; export PATH ; type dmake)"

--

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Trond Norby » Tue, 27 Jul 1999 04:00:00



> So why not?
> rsh somewhere "(PATH=\$PATH/usr/local/bin ; export PATH ; type dmake)"

Because then I need to know the full path of every program on that
computer (unless they are symblinked form a central directory). I also
need to export all the other env-settings I would like, and I am too
lazy to write 1k of arguments in a rsh.

Well I have found out that if I use a C-shell I can set the path in a
$HOME/.cshrc file, and the Korn-shell equivalent is the file specified
in ENV. So the new question is: Where should I set ENV so my
$HOME/.kshrc file would be executed.

Trond Norbye

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Steve Bellen » Tue, 27 Jul 1999 04:00:00





>> So why not?
>> rsh somewhere "(PATH=\$PATH/usr/local/bin ; export PATH ; type dmake)"

>Because then I need to know the full path of every program on that
>computer (unless they are symblinked form a central directory). I also
>need to export all the other env-settings I would like, and I am too
>lazy to write 1k of arguments in a rsh.

>Well I have found out that if I use a C-shell I can set the path in a
>$HOME/.cshrc file, and the Korn-shell equivalent is the file specified
>in ENV. So the new question is: Where should I set ENV so my
>$HOME/.kshrc file would be executed.

rsh somewhere "(ENV=\$HOME/.kshrc ; export ENV ; command)"

But this silly, what is it you really want to do? It now sounds like
you want `rsh x y' to execute exactly like the command `y'. If so, even
putting the path in .cshrc or .kshrc will not do this. For one thing
the current directory could be different.

Putting the path in .cshrc or .kshrc is not exactly the "right way" to
do things. I believe this causes csh to rehash its commands on every
execution.

Suggestions:
1. Try ssh, it is smarter about carrying environment variables.
2. Look into shell wrappers/ aliases to automate your 1k arguments
in a rsh.
3. Rsh commands are not exactly for the great unwashed and they are
tricky even for the washed. I wouldn't encourage there "raw" use.
--

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Trond Norby » Tue, 27 Jul 1999 04:00:00



> rsh somewhere "(ENV=\$HOME/.kshrc ; export ENV ; command)"

> But this silly, what is it you really want to do? It now sounds like
> you want `rsh x y' to execute exactly like the command `y'. If so, even
> putting the path in .cshrc or .kshrc will not do this. For one thing
> the current directory could be different.

> Putting the path in .cshrc or .kshrc is not exactly the "right way" to
> do things. I believe this causes csh to rehash its commands on every
> execution.

> Suggestions:
> 1. Try ssh, it is smarter about carrying environment variables.
> 2. Look into shell wrappers/ aliases to automate your 1k arguments
> in a rsh.
> 3. Rsh commands are not exactly for the great unwashed and they are
> tricky even for the washed. I wouldn't encourage there "raw" use.
> --


Well, I am just trying to set up distributed make (dmake). dmake will
distribute make-jobs to the build servers with rsh, so I need the
compiling environment when the rsh-command is executing.

It may be me, or it may be that the documentation sucks when it comes to
how I should configure the machines..

Trond Norbye

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Steve Bellen » Tue, 27 Jul 1999 04:00:00




Quote:>Well, I am just trying to set up distributed make (dmake). dmake will
>distribute make-jobs to the build servers with rsh, so I need the
>compiling environment when the rsh-command is executing.

>It may be me, or it may be that the documentation sucks when it comes to
>how I should configure the machines..

Documentation and gravity always have something in common. The dmake
man file does suggest adding the path to .cshrc but that will not help
ksh users. It makes dmake seem broken to me.

Other Options:
1. Ssh again but you will have to replace rsh with ssh. One configures
ssh to have a default path.
2. Find the source to rsh/in.rshd and recompile it to give a path more
your liking.
3. A script or alias called rsh which will call /bin/rsh with a new PATH
appended. Perhaps something like like the below will work. I didn't test
it.

#!/bin/sh
#
#set -x
host=$1;
shift
case $SHELL in
    *csh)
/bin/rsh $host "(setenv PATH $PATH; $*)"
    ;;
    *sh)
/bin/rsh $host "(PATH=$PATH export PATH; $*)"
    ;;
esac

--

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Robert S. Campbe » Tue, 27 Jul 1999 04:00:00


: When I try: rsh localhost echo \$PATH
: I always get "/usr/bin:", but if I try:
: rsh localhost
: echo $PATH
: I get the path I expected

In a later post you mention using csh.  For csh, if you rlogin or telnet
into a machine, it will read both ~/.cshrc and ~/.login, however, if you
just use rsh, it will only source your ~/.cshrc file.

So, venturing a guess, you've got your path set up in your .login, and
not your .cshrc.

--
Bob Campbell                    Unix System Administrator
Scientific Computing Division   National Center for Atmospheric Research

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by Trond Norby » Tue, 27 Jul 1999 04:00:00


Well, thank you for your help and time :-)

I think I am going to solve the problem by adding a compilation user to
my system with a C-shell...

Trond Norbye

 
 
 

PATH set by "rsh localhost echo \$PATH"

Post by J.A. Gutierre » Wed, 28 Jul 1999 04:00:00


: case $SHELL in
:     *csh)
: /bin/rsh $host "(setenv PATH $PATH; $*)"
:     ;;
:     *sh)
: /bin/rsh $host "(PATH=$PATH export PATH; $*)"
:     ;;
: esac

        what if your SHELL at $host is not $SHELL?

        instead I'd try

        /bin/rsh $host "env PATH=foo:bar $*"

--
PGP and other useless info at      \                      Oh, show us the way
http://www.cps.unizar.es/~spd/      \                  to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                           Weill/Bretch
Lo que si que es cierto es que la felicidad no da el dinero...

 
 
 

1. set path = "$path" hoses path in tcsh -- why???

All:

  % echo $path
  /usr/local/bin /usr/pubsw/bin /usr/bin ...
  % ls
  [... etc ... it works]
  % set path = "$path"   *** What the hell happens here??? ***
  % echo $path
  /usr/local/bin /usr/pubsw/bin /usr/bin ... looks the same
  % ls
  ls: Command not found.

This is just a particularly egregious illustration of the problem. In
general, if I try to do something like this:

  % set savedPath = "$path"  # Save current path
  % set path = "$savedPath"  # Restore saved path

it doesn't work. The path *looks* the same, but the shell can't find
anything. Recall that the shell variable path and the environment
variable PATH are linked, so setting one automatically sets the other
also. Some unexpected feature of list interpolation perhaps? Bug or
feature, I call it a pain...

Andrew Duncan

2. sched-2.5.64-D3, more interactivity changes

3. How to expand paths in $PATH like "~/bin" to full path?

4. Customlog directive Apache1.2.4

5. .cshrc path problem: "ridiculously long path truncated!"

6. finding latest cdrecord

7. Secure CGI Path Access (translate file path "/" to user homedir)

8. async

9. Path as "su" doesn't equal path as root or as login user

10. echo $PATH | sed "s/:/\n/g"

11. CygWin - PATH finds "myscript.sh" but not "myscript"

12. should argv[0] = "/full/path/to/pgm" or "pgm"?

13. "Proper" use of PATH and directory "purity"