home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / shell / 5066 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  1.0 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!uwm.edu!daffy!uwvax!ssec.wisc.edu!dws
  2. From: dws@ssec.wisc.edu (DaviD W. Sanderson)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: rsh terminates while loop
  5. Message-ID: <1992Dec15.054605.6780@cs.wisc.edu>
  6. Date: 15 Dec 92 05:46:05 GMT
  7. References: <1992Dec14.202147.5077@crd.ge.com>
  8. Sender: news@cs.wisc.edu (The News)
  9. Organization: UW-Madison Space Science and Engineering Center
  10. Lines: 21
  11.  
  12. In article <1992Dec14.202147.5077@crd.ge.com> davidsen@crd.ge.com (bill davidsen) writes:
  13. >It appears that the rsh does /something/ which wipes out the stdin of
  14. >the while loop.
  15.  
  16. Yes.  rsh eats its standard input and gives it to the remote command.
  17. The rsh man page on my system says this:
  18.  
  19.     The rsh command sends standard input from the local command
  20.     line to the remote command
  21.  
  22. >If anyone has some words of wisdom on this I'd love to hear them,
  23.  
  24. Redirect the rsh input from /dev/null:
  25.  
  26.     #!/bin/sh
  27.     while    read host flags
  28.     do    result=`rsh $host uname $flags < /dev/null`
  29.         echo "$host: $result"
  30.     done
  31.  
  32. DaviD W. Sanderson (dws@ssec.wisc.edu)
  33.