让你的shell程序关键部分不被打断
时间:2008-07-13 来源:jackylau
#cat t.sh
#!/bin/sh
trap '' 1 2 3 15
echo "I'll sleep 20 second,please don't have to disturb!"
sleep 20
trap 1 2 3 15
当用./t.sh来执行这个程序后,你按Ctrl+c已经不能取消它sleep 20 second了。呵呵!
#!/bin/sh
trap '' 1 2 3 15
echo "I'll sleep 20 second,please don't have to disturb!"
sleep 20
trap 1 2 3 15
当用./t.sh来执行这个程序后,你按Ctrl+c已经不能取消它sleep 20 second了。呵呵!
相关阅读 更多 +