do
if ping -c 1 -W 1 ${Test1}$i &> /dev/null ;then
echo "Have ${Test1}$i"
Num=$((Num+1))
else
Fail=$((Fail+1))
echo "No ${Test1}$i"
fi
done
echo "Host online have $Num ."
echo "Host no online have $Fail ."
最后一个for循环,我嫌多,只写了10个值,有兴趣的哥们,自己改 seq 1 10改成1 254即可...还有关于a类b类c类网,由于本人网络方面知识的欠缺,所以判断的值,估计挺不正确的,列位就谅解一下吧....