检测内网IP地址段的存活
#!/bin/bash
function detect(){
ping=`ping -c 1 $1 &>/dev/null`
}
for i in {0..254};do
detect 193.168.1.$i
if [ $? -eq 0 ];then
echo -e "\033[32mIP 193.168.1.$i is up\033[0m"
else
echo -e "\033[31mIP 193.168.1.$i is down\033[0m"
fi
done