2013年7月22日

linux中脚本扑捉(trap)信号问题

摘要: 扑捉ctrl+c信号:1 #!/bin/bash2 trap "trap" 2;3 function trap()4 {5 echo "You press Ctrl+C.";6 echo "Exiting,please wait...";7 exit;8 }9 sleep 20s;按下ctrl+c:1 root@ubuntu:/home/dyx/linux 16:13:10 107# bash ex_trap.sh 2 ^CYou press Ctrl+C.3 Exiting,please wait...但是如果把trap函数发在前面 阅读全文

posted @ 2013-07-22 16:40 yi_meng 阅读(1906) 评论(0) 推荐(0) 编辑

linux中文件描述符

摘要: #exec命令用于启动一个新的shell,并在新的shell中执行指定命令。在实际应用中,exec命令被用来 处理文件描述符,此时(也只在此时)exec不会启动新shell替代当前的shell。 1 root@ubuntu:/home/dyx/linux 10:40:36 19# cat ping.txt 2 PING baidu.com (220.181.111.85) 56(84) bytes of data. 3 64 bytes from 220.181.111.85: icmp_req=1 ttl=52 time=32.1 ms 4 64 bytes from 220.181.11. 阅读全文

posted @ 2013-07-22 10:34 yi_meng 阅读(556) 评论(0) 推荐(0) 编辑

导航