用脚本检测局域网络是否可以ping通:
#!/bin/bash
for i in {1..254}
do
HOST=192.168.0.$I
ping -c2 $HOST &>/dev/null
if [ $? = 0 ]; then
echo "$HOST is up!"
else
echo "$HOST is down!"
fi
done
本文共 215 字,大约阅读时间需要 1 分钟。
用脚本检测局域网络是否可以ping通:
#!/bin/bash
for i in {1..254}
do
HOST=192.168.0.$I
ping -c2 $HOST &>/dev/null
if [ $? = 0 ]; then
echo "$HOST is up!"
else
echo "$HOST is down!"
fi
done
转载于:https://blog.51cto.com/milostar/692069