| 您的位置:首页 > 文档 > Shell > |
文章分类热门文章 |
shell脚本问题创建:2005-10-26 00:49:45 作者:Unlinux 来自: http://www.Unlinux.com 写了一段程序但有些问题: 有几十台unix系统,我想查硬盘空间,假如有某台机关了或线路不通,如何可以跳过不通的系统继续往下? centre() { rexec computer_$1 df return } if(test $# = 0) then clear for name in `cat tmp1` do echo "--------------------------------------------------$name " centre $name done else(test $# = 1) banner $1 centre $1 fi 可以用ping来检测网络 ping -c 1 $1 1>/dev/null 2>&1 if test $? -ne 0 then echo "与$1不通" exit 0 fi centre() { rexec computer_$1 df return } if(test $# = 0) then clear for name in `cat tmp1` do echo "--------------------------------------------------$name " ####以下几行新增##### ping -c 1 $name 1>/dev/null 2>&1 if test $? -ne 0 then echo "$name不通" continue fi ####以上几行新增##### centre $name done else(test $# = 1) banner $1 centre $1 fi 转载自:http://www.unlinux.com/doc/shell/20051026/219.html 【评论】 【加入收藏夹】 【大 中 小】 【打印】 【关闭】 ※ 相关链接
|