测试网内主机存活状态

#!/bin/bash

LOOP=0
for N in {1..100}
  do
  host=192.168.0.$N
  ping -c 2 $host &> /dev/null
if [ $? = 0 ];then
 echo "$host is Up"
else
 echo "$host is Down"
#统计数量
 LOOP=`expr $LOOP + 1`
fi
done
echo "There is $LOOP Servers is Down!"


你可能感兴趣的:(null,统计,主机)