Other (Shell/System) Sigterm behaviour of foreground jobs vs bg jobs in bash

I'm wondering why if, in a bash shell when I run sleep 100, and then kill the bash shell, both commands get killed, but if I run sleep 100 & and kill the bash shell, the sleep process remains.

Can any explain this behaviour, and give me links for further reading if possible?
 
What are the commands you are using? If I pkill -9 bash when I both sleep 200 & and sleep 202 running, both processes get re-parented to PID 1. This is the expected behaviour for that case. A normal kill doesn't work. The shell appears to ignore the signal since it is still running something.
 
Back
Top