bash 的 shopt huponexit 何時開始預設關閉?

bash 的 shopt huponexit 何時開始預設關閉?

週一早上,我登入一個盒子ssh並執行以下命令:

tail -f /var/log/foo/bar.log | grep something_interesting &

當天晚些時候,我按 Ctrl+D 註銷了。

週五,我登入同一個盒子,發現tail進程仍在運行。當我退出時,我以為他們已經退出了。

經過進一步挖掘,似乎在該機器上以及我嘗試過的所有其他 Linux 機器上以及我嘗試過的 Mac OS X 機器上都shopt huponexit設定為。off

什麼時候開始默認為off, 而不是on

答案1

在 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;
+

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

相關內容