bash – 退出zsh,但保持运行作业打开?

前端之家收集整理的这篇文章主要介绍了bash – 退出zsh,但保持运行作业打开?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
刚从bash切换到zsh。

这是bash的行为(使用海豚作为随机示例):

$ dolphin .
^Z
[1]+  Stopped                 dolphin .
$ bg
[1]+ dolphin . &
$ exit

所以它让海豚跑。

这就是我想要的默认行为。

相比之下,这是zsh的行为:

% dolphin .
^Z
zsh: suspended  dolphin .
 % bg
[1]  + continued  dolphin .
 % exit
zsh: you have running jobs.
 % exit

所以它首先警告我有运行的工作。

然后,如果我再次进入退出,它关闭海豚窗口。

我如何使zsh的默认行为在这里像bash的?

zsh documentation

HUP

… In zsh,if you have a background job running when the shell exits,the shell will assume you want that to be killed; in this case it is sent a particular signal called SIGHUP… If you often start jobs that should go on even when the shell has exited,then you can set the option NO_HUP,and background jobs will be left alone.

所以只要设置NO_HUP选项:

% setopt NO_HUP
原文链接:/bash/389727.html

猜你在找的Bash相关文章