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
	echo .
	sleep 1

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