1 2 3 4 5 6 7 8 9
echo before trap trap 'echo caught sigint' 2 echo after trap for i in 1 2 3 do echo $i sleep 5 done