Signal Trapping Using Functions

You can easily catch signals thrown at your process and call a function which needs to be defined beforehand:

function sigtrap() {
	echo sigtrap
}

trap "eval sigtrap" HUP

while true
do
	echo .
	sleep 1
done

trap -
Feedback is always welcome! If you'd like to get in touch with me concerning the contents of this article, please use Twitter.