home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!merlin!cerberus!cerberus.bhpese.oz.au!Sm
- From: Sm@cerberus.bhpese.oz.au (Scott Merrilees)
- Subject: Re: rsh terminates while loop
- Organization: BHP, Newcastle, Australia
- Date: Wed, 16 Dec 1992 01:57:18 GMT
- Message-ID: <1992Dec16.015718.14727@cerberus.bhpese.oz.au>
- References: <1992Dec14.202147.5077@crd.ge.com>
- Sender: news@cerberus.bhpese.oz.au (News System)
- Lines: 38
-
- davidsen@ariel.crd.GE.COM (william E Davidsen) writes:
-
-
- > 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).
-
- use 'rsh -n' if it works for you, otherwise use 'rsh </dev/null'.
-
- What happens is that the local rsh can't know when the remote process need
- input, so it gobbles up stdin and passes it to the remote process, thus
- using all your input. If the remote process doesn't use all or any of the
- input, then it is lost, because it isn't passed back and reinserted into
- stdin.
-
- Sm
- --
- Scott Merrilees, BHP Information Technology, Newcastle, Australia
- Internet: Sm@bhpese.oz.au Phone: +61 49 40 2132 Fax: ... 2165
-