home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5195 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.8 KB  |  48 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!spsgate!mogate!newsgate!wdc!mario
  3. From: mario@wdc.sps.mot.com (Mario Nigrovic)
  4. Subject: BOURNE - exec >/dev/null 2>&1 wierdness
  5. Message-ID: <1992Dec30.190932.7963@newsgate.sps.mot.com>
  6. Sender: mario@wdc (Mario Nigrovic)
  7. Nntp-Posting-Host: 223.199.55.4
  8. Organization: Motorola Western MCU Design Center, Chandler Arizona
  9. Date: Wed, 30 Dec 1992 19:09:32 GMT
  10. Lines: 36
  11.  
  12. Hello,
  13.    I am writing a Bourne shell script and am having some strange
  14. interactions seemingly caused by exec >/dev/null 2>&1.  Let me
  15. provide some details:
  16.  
  17.    Sun Sparc2, 4.1.1b
  18.  
  19.    I have a function called verify_tape which internally might just
  20. want to create a log file.  After I've created it, and before I can
  21. mail the log file to the administrator, I want to close it, right?
  22. So I do the exec >/dev/null 2>&1.  Seems to work just fine, except
  23. that MUCH later on, when I run dump(8), all it's output gets lost,
  24. DESPITE THE FACT that I've exec'd to a new log file before then.
  25.  
  26.    I fixed this above problem by kicking the function calls into
  27. subshells, but this still leaves me confused.  Furthermore, I am now
  28. having a similar problem with Mail, because again I've closed the
  29. log file before mailing it.
  30.  
  31.  
  32.    This whole thing seems to me to be a bit of a mess; is there
  33. really anything dangerous (or permanent) about redirecting the shell's
  34. outputs to /dev/null?
  35.  
  36.    Please respond via E-Mail, and I'll summarize if requested.  The
  37. correct email address appears below.  Thanks for your time.
  38.  
  39.                             Mario
  40.  
  41. Mario Nigrovic <mario@wdc.sps.mot.com>        voice: (602) 821-4264
  42. Motorola Western MCU Design Center        fax:   (602) 821-4058
  43. *  -  -  -  -  -  -  -  -  -  -  -*-  -  -  -  -  -  -  -  -  -  -  *
  44. I profoundly believe it takes a lot of practice to become a moral
  45. slob.
  46.         -- William F. Buckley
  47. *  -  -  -  -  -  -  -  -  -  -  -*-  -  -  -  -  -  -  -  -  -  -  *
  48.