加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

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

发布时间:2020-12-15 09:17:38 所属栏目:安全 来源:网络整理
导读:刚从bash切换到zsh。 这是bash的行为(使用海豚作为随机示例): $ dolphin .^Z[1]+ Stopped dolphin .$ bg[1]+ dolphin . $ exit 所以它让海豚跑。 这就是我想要的默认行为。 相比之下,这是zsh的行为: % dolphin .^Zzsh: suspended dolphin . % bg[1] + con
刚从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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读