I am surprised that at least from Bash 4.4.19, Interactive Bash runs commands in a separate session, see following process list after I run sleep 8888
:
PGID PID PPID
3150071 3150071 252603 -bash
3194323 3194323 3150071 sleep 8888
You can see the PGID
of sleep
does not equal to the bash, while its PPID does.
The test is done on Ubuntu Bionic.
Is there any documentation about this behavior change? or it has been acting this way since the beginning?
Running commands in a separate session means that the SIGHUP effects does not happen at all when bash exits, maybe this is why https://www.sobyte.net/post/2022-04/linux-nohup-setsid-disown/#about- says
In fact, on newer versions of bash, bash does not send SIGHUP commands to background programs. That means that any process running in the background ending with & will not be exited by the SIGHUP signal for terminal exit.
EDIT: I should use the term "process group" instead of "session".