[comp.unix.shell] passing envars to remote shell

rhartman@thestepchild.sgi.com (Robert Hartman) (04/24/91)

In article <1991Apr23.003518.4442@leland.Stanford.EDU> dkeisen@leland.Stanford.EDU (Dave Eisen) writes:
>In article <6226@iron6.UUCP> yeates@motcid.UUCP (Tony J Yeates) writes:
>>"The current local environment is not passed  to  the  remote shell."
>>
>
>It isn't, and there is no real way to get around this. What I usually
>do when I want to pass something to a remote shell is to explicitly set the 
>environment variable in the command, something like (using /bin/sh as the 
>login shell):
>
>rsh silicon "VARIABLE=$VARIABLE; export VARIABLE; command-line"

Well, I suppose a person could write a wrapper for rsh that invoked it
that way:

	# ...
	# parsing routine for rsh args (e.g., -l username)
	# ...

	varnames=`printenv | sed 's/=.*//'`
	rsh $host $options; `printenv` ; export $varnames ; $command

Might be overkill though.

-r