#!/bin/bash
echo "please input begin num: "
read begin_num
echo "please input end num: "
read end_num
echo "Test is begining...."
for i in `seq $begin_num $end_num`
do
export host=172.16.1.$i
c=`ping -c 10 $host |grep 'packet'|gawk -F "," '{print $3}'|gawk '{print $1}'|sed s/\%//`
echo
echo "$c% packet loss for $host"
if [ $c -lt 10 ];then
echo "The host $host is lived "
else
if [ $c -lt 50 ];then
echo "The host $host is edge of life and death "
else
echo "The host $host is die"
fi
fi
done
########################################################################