正在加载图片...
echo“ This is a new file (sleep 5; date)& echo“ the file terminate” April2010:0826BJT2002-04-20 The file terminate 6)trap:中断处理命令 trap命令表中断信号表 #cat trapfile trap trap echo This is INT. 3 for I in /bin /bin/usr cho si done 下面程序实现scan:扫描当前目录下的每一个子目录,并执行用户提交的命令: then cd sd/Si while echo“si trap exit 2 f1 7)点命令 在bsh利用命令执行一个命令时,不创建子进程。(csh中用 source) 8)空命令:不做任何事情 1.11she1l程序实例 下面程序 dircm测试当前目录与指定目录是否含有相同文件数 if test S#-ne 1 then echo"Usage: dircm dirname exit 1 else if test I-d SI then echo"IS1\"is not a directoryecho “This is a new file” (sleep 5; date)& wait echo “the file terminate” 执行结果: This is a new file April 20 10:08:26 BJT 2002-04-20 The file terminate 6) trap:中断处理命令 trap 命令表 中断信号表 #cat trapfile trap echo ‘ This is INT 2’ 2 trap echo ‘ This is INT 3’ 3 for I in /bin /bin/usr do echo $I done 下面程序实现 scan:扫描当前目录下的每一个子目录,并执行用户提交的命令: d=`pwd` for i in * do if test –d $d/$i then cd $d/$i while echo “$i:” trap exit 2 read x do trap : 2 ; eval $x; done fi done 7)点命令 . 在 bsh 利用 . 命令执行一个命令时,不创建子进程。(csh 中用 source) 8)空命令:不做任何事情 1.11 shell 程序实例 下面程序 dircmp 测试当前目录与指定目录是否含有相同文件数 if test $# -ne 1 then echo “Usage:dircmp dirname” exit 1 else if test !-d $1 then echo “\”$1\” is not a directory” exit 1 else
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有