标签:
命令:trap "commond" 1 2 3 20 15 或者 trap "commond" HUP INT QUIT TSTP
trap " " 2 //屏蔽ctrl c
trap ":" 2 //执行循环后按ctrl z ,使用命令恢复ctrl c
跳板机
function trapper(){
trap ‘ ‘ INT EXTI TSTP TERM HUP QUIT
// ctrl+c ctrl+z 关机 用户掉线、退出 ctrl+/
}
trapper
clear
cat << menu
1.ssh ip1
2.ssh ip2
3.exit
menu
read -p "pls input the (1|2|3):" num
case "$num" in
1)ssh ip1
;;
2)ssh ip2
;;
3|*)exit
;;
esac
标签:
原文地址:http://www.cnblogs.com/mayuansheng/p/5691489.html