全部博文(7)
分类: LINUX
2013-02-16 13:04:10
[root@localhost ~]# vi ping.sh
#!/bin/bash
#ping
for ip in 192.168.1.{1..254}; do
ping -i 0.1 -c 2 -W 2 $ip &> /dev/null
if [ $? -eq 0 ]; then
echo "Host $ip is up."
else
echo "Host $ip is down."
fi
done