测试一个C段网络的联通性

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
network="222.88.95"
for ip in $(seq 1 255)
do
ping -c 1 -w 1 ${network}.${ip} &>/dev/null &&result=0 || result=1
if [ "$result" == "0" ];then
        echo "$network.$ip is up"
else
        echo "$network.$ip is down"
fi
done 

一无所知的世界走下去才会有惊喜 It will be a surprise right know nothing about the world
原文地址:https://www.cnblogs.com/yangxiaofei/p/4953560.html