检查一个范围内ip存活
时间:2010-12-02 来源:非洲乌龟
#!/bin/bash
i=0
for var in {1..254}
do
ping -c 2 192.168.1.$var >/dev/null 2>&1
status=$?
if [ $status = 0 ];then
echo "ping 192.168.1.$var is up" >>up.txt
else
echo "ping 192.168.1.$var is down" >>down.txt
fi
done
i=0
for var in {1..254}
do
ping -c 2 192.168.1.$var >/dev/null 2>&1
status=$?
if [ $status = 0 ];then
echo "ping 192.168.1.$var is up" >>up.txt
else
echo "ping 192.168.1.$var is down" >>down.txt
fi
done
相关阅读 更多 +