判断条件:能ping通即在线

#!/bin/bash
for n in `seq 254`
do
    ping -c2 10.0.0.$n >/dev/null 2>&1
    if [ $? -eq 0 ]
    then
        echo "10.0.0.$n is up" >> uplist.log
    else
        echo "10.0.0.$n is down" >> downlist.log
    fi
done