Ricardo

Bash trap 捕获 SIGINT 的示例

阅读时长: 1 分钟

[user@local ~]$ cat trap.sh #!/bin/bash trap “echo xxxxx; exit” SIGINT mkdir -p /home/username/traptest/docs while : do echo $(date) Writing fortune to /home/username/traptest/docs/index.html echo “do something $(date)” > /home/username/traptest/docs/index.html sleep 10 done

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
记录自己
Built with Hugo
主题 Stack 由 Jimmy 设计