Files
tldr/pages.zh/common/trap.md
Sebastiaan Speck fd745e9167 df, exec, exit, export: fix more info link (#12037)
* df, exec, exit, export: fix more info link

* df: update outdated Farsi translation

---------

Co-authored-by: Mohammad Reza Soleimani <87926618+MrMw3@users.noreply.github.com>
Co-authored-by: Vitor Henrique <87824454+vitorhcl@users.noreply.github.com>
2024-01-09 14:31:59 +05:30

22 lines
478 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# trap
> 在进程或操作系统接收到信号后自动执行命令。
> 可用于对用户中断或其他操作执行清理。
> 更多信息:<https://manned.org/trap.1posix>.
- 列出设置 trap 的可用信号:
`trap -l`
- 列出当前 shell 程序的活动 trap 程序:
`trap -p`
- 设置 trap 以在检测到一个或多个信号时执行命令:
`trap 'echo "检测到信号 {{SIGHUP}}"' {{SIGHUP}}`
- 移除活动 trap
`trap - {{SIGHUP}} {{SIGINT}}`