批量测试ping通不通

2015-09-20 0 681
批量测试ping通不通
#!/bin/sh
A=`cat ip.txt`
echo "先将IP 分行写在ip.txt文件中,然后执行sh ping2.sh"
for B in $A
do
str=`ping -c 3 $B`
#echo $str
ip_str=${str:4:14}
loss=`echo $str|grep "100% packet loss"|wc -l`
if [ $loss != 0 ]
then
   echo "ping不通的IP#####:$ip_str"
   #echo $ip_str>>ipout.txt
else 
   echo "可以ping通的IP>>>>:$ip_str"
fi

done

遇见资源网 shell 批量测试ping通不通 http://www.ox520.com/17145.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务