#!/bin/sh
domain=`echo $1|awk -F"." '{print $1"."$2"."$3"."}'`
start_ip=`echo $1|awk -F"." '{print $4}'`
end_ip=`echo $2|awk -F"." '{print $4}'`
echo "domain is $domain"
function Scan() {
    ping -c 1 $1$2 > /dev/null && echo "$2 is alive" &
    rst=`echo $?`
    return $rst
}

while [ $start_ip -ne $end_ip ]
do
{
    Scan $domain $start_ip
    rst=`echo $?`
    start_ip=$((start_ip+1))
}
done
wait