Background process getting killed when its parent is terminated?
<p>I have code that looks something like this</p>

<pre><code>function doTheThing{
  # a potentially infinite while loop...
}
# other stuff...
doTheThing &amp;
trap "kill $!" SIGINT SIGTERM
</code></pre>

<p>Strangely, when I ctrl-C out of the parent process before the loop is done, I get a message that the process doesn't exist. Furthermore, if I get rid of the trap, I can't find the process with a ps -aF. It looks like the background process is getting killed when its parent is terminated, but my understanding was that wasn't supposed to happen. I just want to make sure that I can safely leave out the trap and not leave zombie processes everywhere.</p>