命令记不住

登陆

ping shell

批量检查ip

#!/bin/bash
for ip in 10.172.7.{1..254}
do
if  ping -c 1 $ip >/dev/null 2>&1 ; then
        echo "$ip yes"
else
        echo "$ip no!"
fi
done

和

#!/bin/bash
cat IPList | while read line
do
if  ping -c 1 $line >/dev/null 2>&1 ; then
        echo "$line yes" 
else   
        echo "$line no!"
fi  
done

批量ping

推荐阅读