_trap

来自「linux程序设计(第2版)」· 代码 · 共 28 行

TXT
28
字号
#!/bin/shtrap 'rm -f /tmp/my_tmp_file_$$' INTecho creating file /tmp/my_tmp_file_$$date > /tmp/my_tmp_file_$$echo "Press interrupt (Ctrl-C) to interrupt...."while [ -f /tmp/my_tmp_file_$$ ]; do    echo File exists    sleep 1doneecho The file no longer existstrap -INTecho creating file /tmp/my_tmp_file_$$date > /tmp/my_tmp_file_$$echo "Press interrupt (Ctrl-C) to interrupt...."while [ -f /tmp/my_tmp_file_$$ ]; do    echo File exists    sleep 1doneecho We never get hereexit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?