RosettaCodeData/Task/Handle-a-signal/UNIX-Shell/handle-a-signal-1.sh
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

7 lines
286 B
Bash

c="1"
# Trap signals for SIGQUIT (3), SIGABRT (6) and SIGTERM (15)
trap "echo -n 'We ran for ';echo -n `expr $c /2`; echo " seconds"; exit" 3 6 15
while [ "$c" -ne 0 ]; do # infinite loop
# wait 0.5 # We need a helper program for the half second interval
c=`expr $c + 1`
done