#!/bin/bash
#This script will count up the number of active IP in the current network segment!
declare -i num=0
for i in {1..254}
do
ping -c2 192.168.0.$i &> /dev/null
if [ $? = 0 ];then
num=$num+1
fi
done
echo "The number of up host in 192.168.0.0/24 is $num"
这个脚本虽然可以运行,但是速度特别慢。。。