Skip to content

Instantly share code, notes, and snippets.

@homerquan
Created November 8, 2017 15:51
Show Gist options
  • Save homerquan/d59f91af7b7612098db2f3995dbac733 to your computer and use it in GitHub Desktop.
Save homerquan/d59f91af7b7612098db2f3995dbac733 to your computer and use it in GitHub Desktop.
intexit() {
# Kill all subprocesses (all processes in the current process group)
kill -HUP -$$
}
hupexit() {
# HUP'd (probably by intexit)
echo
echo "Interrupted"
exit
}
trap hupexit HUP
trap intexit INT
{ CMD1 } &
{ CMD2 } &
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment