On Wed, Jun 30, 2010 at 06:50:38PM -0600, Bob Proulx wrote: > In ksh the > sleep would be ksh itself
Oh, interesting. imadev:~$ ksh -c 'type sleep' sleep is /usr/bin/sleep arc3:~$ ksh -c 'type sleep' sleep is a shell builtin Looks like sleep is a builtin in ksh93 but not in ksh88. Good to know. > #!/bin/bash > trap 'test -n "$childpid" && kill $childpid; echo killed by SIGALRM; exit > 1' ALRM > function wait_kill() { > sleep 5 > kill -ALRM $$ 2>/dev/null > } > wait_kill & > waitkillpid=$! > sleep 3600 & > childpid=$! > wait $childpid > test -n "$waitkillpid" && kill $waitkillpid 2>/dev/null > P.S. In the old days mixing sleep(3) and SIGALRM was frowned upon. ... But this is bash, so you're using sleep(1) not sleep(3). In other words, the "sleep 5" is an external process, and its handling (or non-handling) of SIGALRM should in no way affect the trap set by bash.