Created
June 25, 2018 21:31
-
-
Save bkj/4ba1b2828df846c6b2261e65bee4c8cb 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/bash | |
cleanup() { | |
echo "cleanup"; | |
local pids=$(jobs -pr); | |
[ -n "$pids" ] && kill $pids; | |
}; | |
trap "cleanup" INT QUIT TERM EXIT | |
# Put this at the beginning of a file to kill children |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment