I have a script from which I run a second script in a subshell. What's the soonest that can send a signal to the second script?
./script2 & kill -SIGCONT $!
echo "~~ ENTRY" trap 'SUSPEND=false' SIGCONT SUSPEND=true while $SUSPEND; do; sleep 1; done echo "~~ EXIT"
This won't work, the terminal will just hang there in "suspended" mode. My guess is that because I call
kill straight away after I run script2, the trap in script2 doesn't have time to get parsed, and thus nothing happens - race condition.
So what's the soonest I can send the signal to the child process - making sure that it gets trapped?