rsh guru req'd!

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Thu Apr 25 12:53:20 AEST 1991


In article <6226 at iron6.UUCP> yeates at 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 at 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



More information about the Comp.unix.shell mailing list