Signal Trapping Using Functions
Published on 30 Nov 2007Tags #Bash
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 -