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

  1. Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!ariel!davidsen
  2. From: davidsen@ariel.crd.GE.COM (william E Davidsen)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: rsh terminates while loop
  5. Message-ID: <1992Dec16.163349.16919@crd.ge.com>
  6. Date: 16 Dec 92 16:33:49 GMT
  7. References: <1992Dec14.202147.5077@crd.ge.com> <1992Dec15.054605.6780@cs.wisc.edu>
  8. Sender: usenet@crd.ge.com (Required for NNTP)
  9. Reply-To: davidsen@crd.ge.com (bill davidsen)
  10. Organization: GE Corporate R&D Center, Schenectady NY
  11. Lines: 30
  12. Nntp-Posting-Host: ariel.crd.ge.com
  13.  
  14. In article <1992Dec15.054605.6780@cs.wisc.edu>, dws@ssec.wisc.edu (DaviD W. Sanderson) writes:
  15.  
  16. | Redirect the rsh input from /dev/null:
  17. |     #!/bin/sh
  18. |     while    read host flags
  19. |     do    result=`rsh $host uname $flags < /dev/null`
  20. |         echo "$host: $result"
  21. |     done
  22.  
  23.   I told several people who mailed me suggestions to redirect the input
  24. that I had tried it before posting. However, it seems that what I tried
  25. was:
  26.   result=`rsh $host uname $flags` < /dev/null
  27. rather than
  28.   result=`rsh $host uname $flags < /dev/null`
  29. which works.
  30.  
  31.   This is somewhat non-intuitive, and seems to contradict what the man
  32. pages say, although I couldn't find anywhere in which the context of the
  33. `expression` was clearly stated as being (or not being) effected by
  34. redirection.
  35.  
  36.   Thanks to the people who mailed solutions to me, it's clear that
  37. redirection within the quotes will protably work, even if it's not as
  38. clear that redirection outside the quotes doesn't.
  39.  
  40. -- 
  41. bill davidsen, GE Corp. R&D Center; Box 8; Schenectady NY 12345
  42.     Keyboard controller has been disabled, press F1 to continue.
  43.