#!/bin/bashPREFIX=192.168.1 NODE=116 while [ "$NODE" -lt "255" ] do echo -en "Pinging ${PREFIX}.${NODE}..." ping -c1 -w1 -t5 ${PREFIX}.${NODE} >/dev/null 2>&1 if [ "$?" -eq "0" ]; then echo "OK" else echo "Failed" fi let NODE=$NODE+1 done
本文共 357 字,大约阅读时间需要 1 分钟。
#!/bin/bashPREFIX=192.168.1 NODE=116 while [ "$NODE" -lt "255" ] do echo -en "Pinging ${PREFIX}.${NODE}..." ping -c1 -w1 -t5 ${PREFIX}.${NODE} >/dev/null 2>&1 if [ "$?" -eq "0" ]; then echo "OK" else echo "Failed" fi let NODE=$NODE+1 done
转载于:https://blog.51cto.com/ericliu2014/1623563