navigaid
9/12/2018 - 9:40 AM

fun with bash trap mechanism

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