home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / shell / 4756 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.3 KB  |  60 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!think.com!yale.edu!news.yale.edu!neutron!dcs
  3. From: dcs@neutron.chem.yale.edu (Dave Schweisguth)
  4. Subject: Baffled by ksh signal handling
  5. Message-ID: <1992Nov17.182957.14710@news.yale.edu>
  6. Sender: news@news.yale.edu (USENET News System)
  7. Nntp-Posting-Host: neutron.chem.yale.edu
  8. Organization: Yale University
  9. X-Newsreader: TIN [version 1.1 PL6]
  10. Date: Tue, 17 Nov 1992 18:29:57 GMT
  11. Lines: 47
  12.  
  13. Hi all,
  14.  
  15. Makin' myself a little dump-a-random-quote-to-a-pipe thingy. Here it is:
  16.  
  17. --- snip ---
  18. #!/bin/ksh -p
  19.  
  20. action="$1"
  21. file="$2"
  22.  
  23. trap "rm -f $file > /dev/null 2>&1; exit 0" 2
  24.  
  25. rm -f $file > /dev/null 2>&1
  26. /etc/mknod $file p
  27. while :; do
  28.   eval $action >> $file
  29.   sleep 1
  30. done
  31. --- snip ---
  32.  
  33. So why does this happen:
  34.  
  35. [dcs ~] pipe ls foo &
  36. [2] 29707
  37. [dcs ~] cat foo
  38. bin
  39. foo
  40. lib
  41. src
  42. text
  43. tutorial
  44. ws
  45. [dcs ~] killall -2 pipe
  46. /usr/people/dcs/bin/pipe[11]: foo: cannot create
  47. [2]    Done                   pipe ls foo
  48.  
  49. foo _is_ removed. So why doesn't it exit? And it didn't work (or rather
  50. failed in the same way) when I put the trap stuff in a function and just
  51. called the function from the trap.
  52.  
  53. Mail would be fine.
  54.  
  55. TIA,
  56.  
  57. --
  58. | Dave Schweisguth   Yale MB&B & Chemistry   Net: dcs@neutron.chem.yale.edu |
  59. | Lab phone: 203-432-5208     Fax: 203-432-6144    Home phone: 203-624-3866 |
  60.