天天看點

ping C類位址是否線上

vim ping.sh

#!/bin/bash

for I in {1..254};do

if ping -c1 -w2 192.168.0.$I &>/dev/null

then

echo "$I is on line"

else

echo "$I is offline"

fi

done

本文轉自 張玉坡 51CTO部落格,原文連結:http://blog.51cto.com/fighter/462732