fun with bash trap mechanism
#!/usr/bin/env bash echo $$ #trap '' 2 #trap 'echo got SIGINT' 2 trap 'echo got SIGINT' SIGINT while :; do echo 'still alive...' kill -2 $$ sleep 1 done #trap SIGINT