批量ping测试脚本

1、批量ping测试脚本

#!/bin/bash
sum=0
err=0
for i in {"192.168.100.x","192.168.100.xx","192.168.100.x","192.168.100.x","172.16.112.x"};do 
if ping -c1 -w2 $i &> /dev/null;then let sum+=1 echo "$i is ok" else echo "$i is no" let err+=1 fi done echo "$sum" ip is ok! echo "$err" ip is notok!

 

posted @ 2020-06-12 01:38  duanpeng123  阅读(219)  评论(0)    收藏  举报