home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5885 < prev    next >
Encoding:
Text File  |  1992-09-11  |  1.5 KB  |  39 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!nstn.ns.ca!dragon.acadiau.ca!merlin!peter
  3. From: peter@merlin.acadiau.ca (Peter Steele)
  4. Subject: Re: What's the difference between `command` and system('command')?
  5. Message-ID: <peter.716295183@merlin>
  6. Sender: news@dragon.acadiau.ca
  7. Nntp-Posting-Host: merlin
  8. Organization: Acadia University
  9. References: <sasswb.716131013@k2> <1992Sep10.183530.21405@news.eng.convex.com> <peter.716216984@merlin> <1992Sep11.161827@is.morgan.com>
  10. Date: Sat, 12 Sep 1992 10:53:03 GMT
  11. Lines: 26
  12.  
  13. >|> Where does error output go (i.e., stderr)? I have an application
  14. >|> where I want to capture error output, not stdout.
  15.  
  16. >How about
  17.  
  18. >    @lines = `cmd 2>&1`;
  19.  
  20. >This runs cmd with stderr redirected to stdout.  It works with ksh - I
  21. >don't know about csh.q
  22.  
  23. What's happens to normal stdout in this case? Is it lost? The application
  24. I'm writing has to maintain normal stdout as well as stderr. Here's what
  25. I'm doing:
  26.  
  27.   dump 0f - /somefs | compress | dd of=/dev/somedev
  28.  
  29. I want to collect the stderr output of each of these commands. The
  30. only way I can think of doing this in perl is:
  31.  
  32.   `dump 0f - /somefs 2>1.err | compress 2>2.err | dd of=/dev/somedev >3.err`
  33.  
  34. and then open and extract the info I want from the three files that are
  35. created. Is this a reasonable way to do this in perl?
  36. --
  37. Peter Steele        Unix Services Manager            peter.steele@acadiau.ca 
  38. Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364
  39.