Skip to content

Instantly share code, notes, and snippets.

@booyaa
Created September 25, 2015 10:39
Show Gist options
  • Save booyaa/47b6a1f3694b47663e42 to your computer and use it in GitHub Desktop.
Save booyaa/47b6a1f3694b47663e42 to your computer and use it in GitHub Desktop.
catch ctrl-c and exit (but not sigterm 9)
#!/bin/bash
trap -- 'cleanup; exit' SIGINT SIGTERM
cleanup()
{
echo cleaning up
echo now
}
while true;
do
echo boing!
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment