Zhr*_*hro 3 bash signals job-control disown
根据文档:
为防止 shell 向特定作业发送 SIGHUP 信号,应使用 disown 内置命令将其从作业表中删除, 或使用 disown -h 标记为不接收 SIGHUP。
https://www.gnu.org/software/bash/manual/html_node/Signals.html
注意引用中的OR。
我可以确认只需使用disown
without-h
并重新登录该进程没有退出:
#!/bin/bash
( sleep 10s; echo 1 > b ) &
disown
Run Code Online (Sandbox Code Playgroud)
这个-h
选项好像没有必要吧?如果它没有工作,那么它的目的是什么?
如果没有-h
将作业从活动作业表中删除,-h
则不会。
一切都在手册中:
disown [-ar] [-h] [jobspec ...]
(...)
If the -h option is given, each jobspec is not removed
from the table, but is marked so that SIGHUP is not sent to the
job if the shell receives a SIGHUP.
Run Code Online (Sandbox Code Playgroud)
要查看在jobs
使用和不使用-h
.
归档时间: |
|
查看次数: |
182 次 |
最近记录: |