home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / shell / 3943 < prev    next >
Encoding:
Text File  |  1992-09-14  |  705 b   |  22 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!news
  3. From: Harald.Eikrem@delab.sintef.no
  4. Subject: clever `cat' commmand?
  5. Message-ID: <1992Sep14.173218*Harald.Eikrem@delab.sintef.no>
  6. Sender: news@ugle.unit.no (NetNews Administrator)
  7. Organization: SINTEF DELAB, Trondheim, Norway.
  8. Date: 14 Sep 92 17:32:18
  9. Lines: 11
  10.  
  11.  
  12. For once, a question.  Can anyone think of the simplest means of making
  13. a utility that behaves like `cat(1)', but exits with 0 if something went
  14. through it, otherwise 1?  Preferrably a one-liner......
  15.  
  16. I've tried:   awk '{ s=1; print; }; END{ if(s) exit 0; exit 1; }'
  17.  
  18. which is ok with a line oriented input stream, but not with a "binary" 
  19. stream.
  20.  
  21.    ~~harald E.
  22.