When this bash script is run backgrounded, it terminates the calling shell. Why is this?
#!/bin/bash # # weird job control, background termination of parent shell problem set -eum echo "Do not go gentle into that good night" sleep 1
Save this as
chmod +x wat, run it as
wat - no problem. Run it backgrounded:
It closes my current shell!? And even more strangely, if that last sleep line is commented out, it can run backgrounded quite happily. Can anyone explain?
I understand that it's to do with the
-m (job control) option to
set but I don't understand why...