bash 的 shopt huponexit 何时开始默认关闭?

Rog*_*mbe 8 bash nohup history

星期一早上,我登录到一个框ssh并运行以下命令:

tail -f /var/log/foo/bar.log | grep something_interesting &
Run Code Online (Sandbox Code Playgroud)

在当天晚些时候的某个时候,我按 Ctrl+D 注销。

星期五,我登录到同一个盒子,发现tail进程仍在运行。当我退出时,我期待他们退出。

经进一步深挖,似乎shopt huponexit被设置为off在那个盒子,并且在一切其他的Linux机器我试过,并在一台Mac OS X盒我试过。

这什么时候开始默认为off,而不是on?

Jig*_*aga 7

它在 bash 2.02 中引入时默认为关闭:

@@ -119,6 +123,10 @@ int interactive = 0;
 /* Non-zero means that the shell was started as an interactive shell. */
 int interactive_shell = 0;

+/* Non-zero means to send a SIGHUP to all jobs when an interactive login
+   shell exits. */
+int hup_on_exit = 0;
+
Run Code Online (Sandbox Code Playgroud)

http://git.savannah.gnu.org/cgit/bash.git/commit/shell.c?id=cce855bc5b117cb7ae70064131120687bc69fac0