<teg...@renget.se> writes: > trap 'sig_cont' SIGCONT > trap 'sig_term' SIGTERM > trap 'sig_kill' SIGKILL > sleep 400
Note that this test might be affected by the fact that bash will _not_ abort the "sleep 400"; it will wait until it has finished before executing the trap function(!) From man bash: If bash is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the com‐ mand completes. When bash is waiting for an asynchronous command via the wait builtin, the reception of a signal for which a trap has been set will cause the wait builtin to return immediately with an exit sta‐ tus greater than 128, immediately after which the trap is executed. Thus, if you do sleep 400 & wait instead, the trap function will be called as soon as the signal arrives. I got bit by this behaviour trying to do exactly the same that you did. :) -- Regards, Bjørn-Helge Mevik, dr. scient, Department for Research Computing, University of Oslo
signature.asc
Description: PGP signature