检测192.168.100.90⑴92.168.100.100这些IP中有哪些是在使用的
# vi check.sh
#!/bin/bash
#Checks to see if hosts 192.168.100.90⑴92.168.100.100 are alive
for n in {90..100}; do
host=192.168.100.$n
ping -c2 $host &>/dev/null
if [ $? = 0 ]; then
echo "$host is UP"
else
echo "$host is DOWN"
fi
done
# chmod 777 check.sh
# sh check.sh