[sf-perl] [OT] shell signal question

David Alban extasia at extasia.org
Fri Feb 26 14:21:11 PST 2010


spent a little time web searching, and looking through the bash man
page but can't find an answer yet....

when in a bash function called as a result of a trap, how does one
identify the signal caught?

tried running:


     foo () {
       set 2>&1 | sed "s/^/set: /"
       env 2>&1 | sed "s/^/env: /"
       exit 42
     } # foo


     trap foo 1 2 3 11 15

     echo pid=$$
     echo sleeping...

     sleep 60

     exit 0

and interrupting it and looking for any clue in set and env output.
couldn't find anything indicating which signal the program received.
what am i missing?

Live in a world of your own, but always welcome visitors.

More information about the SanFrancisco-pm mailing list