There's something I don't understand. In the trap line for the parent process, the variable "$child_pid" appears. How did that get set?
To clarify, the `wait` is there to avoid zombie processes, which is the script's intention; it should not be `$child_pid` but instead `$!`.
I've amended the post; thank you.