Linux下 检测在使用的IP
检测192.168.100.90-192.168.100.100这些IP中有哪些是在使用的# vi check.sh[html] view plaincopy#!/bin/bash #Checks to see if hosts 192.168.100.90-192.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