cat /tmp/checkaliveip.sh
#!/bin/bash
for num in {1..254}
do
(
Host=192.168.110.$num
# ping -c2 $Host &> /dev/null
ping -c 2 -i 0.2 -w 3 $Host &> /dev/null
[ $? -eq 0 ] && echo -e "# # # # #\t\e[0;5m\e[32m$Host is alive.\e[0m\t# # # # #"
[ $? -ne 0 ] && echo -e "\t\t\t\t\t\t\t\t\t------------\t\e[0;5m\e[4m\e[31m$Host is down.\e[0m\t-------------"
) #&
done
转载于:https://blog.51cto.com/winterysea/1693405