Created
March 3, 2014 13:26
-
-
Save asergeyev/9324881 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this will fire even when sleep is working (when assuming bash) | |
ok(){ | |
echo "TRAP" | |
exit 2 | |
} | |
trap "ok" SIGINT | |
echo "Start sleeping a minute, send me a signal using" | |
echo "kill -s SIGINT $$" | |
sleep 60 & wait | |
echo "Normal quit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# this will only fire when sleep is done (when assuming bash) | |
ok(){ | |
echo "TRAP" | |
exit 2 | |
} | |
trap "ok" SIGINT | |
echo "Start sleeping a minute, send me a signal using" | |
echo "kill -s SIGINT $$" | |
sleep 60 | |
echo "Normal quit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment