Hi. I have a script that creates some background tasks. I want the whole tree to be killed by Ctrl-C.
There's a requirement that the script process and its children must
belong to the same process group. This is why I can't enable job
control.
I don't want to use 'trap', because it adds complexity.
Example:
#!/bin/bash
sleep 90 &
wait $!
After Ctrl-C "sleep 90" stays.
Using trap:
#!/bin/bash
trap 'trap - INT; kill -TERM $noeof_pid; kill -INT $$' INT
sleep 90 &
wait $!
