1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.zh/common/trap.md
Yi Liu 653919fa00
pages.zh/common/*: update Chinese translation (#15962)
Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
2025-03-26 06:38:15 +02:00

17 lines
343 B
Markdown

# trap
> 在接收到事件时执行命令。
> 可用于对用户中断或其他操作执行清理。
> 更多信息:<https://manned.org/trap.1posix>.
- 列出命令和预期事件的名称:
`trap`
- 在接收到信号时执行命令:
`trap 'echo "捕获到信号 {{SIGHUP}}"' {{HUP}}`
- 移除命令:
`trap - {{HUP}} {{INT}}`