[comp.unix.questions] where does rsh get it's path from?

ric@ace.sri.com (Richard Steinberger) (11/17/90)

I have noticed that when I use the rsh command to perform tasks on other
hosts, the path variable is: /bin /usr/ucb /usr/bin and .  .  (I.E., rsh
host2 'echo $path' provides that result).  Since I often want to execute a
command in some other directory (e.g., /usr/local/bin), I've usually
specified the full pathname of the command.  But I was wondering if there is
an easier way to do this.  And I am also curious as to where the initial
path that rsh has comes from.

Here is a common problem:  Vol 3 O'Reilly X11 reference set suggests the
following command for displaying a remote system's load on one's local
workstation or Xterminal:   rsh host 'xload -display host1:0' &.  (p 29)
Since xload is in /usr/bin/X11, the command is not executed because it
is not found in the path that rsh knows about.

Can anyone provide some suggestion as to how to have rsh be able to access
commands that are 'normally' available (w/o full pathname, because users
usually have something like set path = ($path otherdir1 otherdir2 . . .) in
.login) in interactive sessions?  Thanks in advance to all who reply.

regards,

	ric steinberger
	ric@ace.sri.com

tchrist@convex.COM (Tom Christiansen) (11/17/90)

If your shell is the csh, then it will source your .cshrc
upon rsh's and rcp's.   Put this there at the top:
	set path = ......
	if ( ! $?prompt ) exit
Many people put their paths in their .login files. 
This is unfortunate.

I'd swear this is the thirtieth time I've answered this one.

--tom

gwyn@smoke.brl.mil (Doug Gwyn) (11/17/90)

In article <ric.658771231@ace> ric@ace.sri.com (Richard Steinberger) writes:
>Can anyone provide some suggestion as to how to have rsh be able to access
>commands that are 'normally' available (w/o full pathname, ...

Here's an extract from a script that we often use as a wrapper for rsh;
it shows the basic method for exporting environment variables to the
remote system.  "/usr/5bin/env" may need to be changed to simply "env"
for remote systems other than 4BSD with BRL System V emulation installed.

exec rsh `basename $0` /usr/5bin/env PATH="$PATH" TERM="$TERM" \
	sh -c "\"$*\""