home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!ariel!davidsen
- From: davidsen@ariel.crd.GE.COM (william E Davidsen)
- Newsgroups: comp.unix.shell
- Subject: rsh terminates while loop
- Message-ID: <1992Dec14.202147.5077@crd.ge.com>
- Date: 14 Dec 92 20:21:47 GMT
- Sender: usenet@crd.ge.com (Required for NNTP)
- Reply-To: davidsen@crd.ge.com (bill davidsen)
- Organization: GE Corporate R&D Center, Schenectady NY
- Lines: 43
- Nntp-Posting-Host: ariel.crd.ge.com
-
-
- A friend just brought this one in, and I've simplified it down to
- something you can type in and ponder. He wants to call a shell script
- with a filename, and read two variables per line from the file, and
- execute a command on a remote machine using rsh, including the two
- values read off a line.
-
- It appears that the rsh does /something/ which wipes out the stdin of
- the while loop. What I would like to understand is what's happening (I
- already have an ugly but functional workaround).
-
- $ cat y.tmp
- qx1 -a
- qx2 -a
- danqx -l
- $ cat x.tmp
- #!/bin/sh
- while read host flags
- do
- result=`rsh $host uname $flags`
- echo "$host: $result"
- done
- $ ./x.tmp < y.tmp
- qx1: qx1
- $
-
- Note that after reading a single line from the file the while loop ends.
- Any command other than rsh does not cause this, and if you use ksh you
- get an illegal IOCTL fault (under SunOS).
-
- This fails under SunOS and HP-UX, but works with SCO ODT at a minimum,
- supposedly fails on virtually anything with a form of rsh (aka rcmd,
- remsh, etc) based on BSD code. I *think* it's a bug in rsh in the
- redirecting of the i/o to sockets and pulling it back, but I don't
- swear to it.
-
- If anyone has some words of wisdom on this I'd love to hear them, it
- really should be valid as posted. I'll try to get a chance to test on a
- few other machines in the next few days.
-
- --
- bill davidsen, GE Corp. R&D Center; Box 8; Schenectady NY 12345
- Keyboard controller has been disabled, press F1 to continue.
-