Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!sixhub!davidsen From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr) Newsgroups: comp.unix.shell Subject: Re: rsh guru req'd! Keywords: rsh Message-ID: <3796@sixhub.UUCP> Date: 25 Apr 91 02:53:20 GMT References: <6226@iron6.UUCP> Reply-To: davidsen@sixhub.UUCP (bill davidsen) Distribution: comp.unix.shell Organization: *IX Public Access UNIX, Schenectady NY Lines: 37 In article <6226@iron6.UUCP> yeates@motcid.UUCP (Tony J Yeates) writes: | The rsh man page includes the following line:- | "The current local environment is not passed to the remote shell." | | Does anybody know a good way to get around this (ie export | your current environment to rsh). This seems to be a | severe restriction. | | [The problem I have is that when I rsh scripts (which I do not own) | they fail, because some of the commands that they use cannot | be found (doing "rsh silicon echo '$PATH'" reveals my path is | severely truncated...":/usr/ucb:/bin:/usr/bin").] I guess this is of general interest... first you save the environment via: set > my.env on some really old copies of shell you must (set) 2>my.env Then put the command(s) on the end of the environment and send to the rsh: echo "pwd;ping pong;who" | cat my.env - | rsh elsewhere /bin/sh Of course about the 2nd time you do it: ersh() { echo "$2" | cat my.env - | rsh $1 /bin/sh } then you can say: ersh othermach.far.away "who;ping pong" -- bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen) sysop *IX BBS and Public Access UNIX moderator of comp.binaries.ibm.pc and 80386 mailing list "Stupidity, like virtue, is its own reward" -me