代码如下:
- if [ "$3" = "" ]
- then
- echo "sh test_ratio.sh dns_ip domain times";
- exit;
- fi
- test_time=$3;
- sdns_ip=$1;
- domain=$2;
- > /tmp/test_ratio.log
- for((i=0;i<$test_time;i++))
- do
- dig +short @$sdns_ip $domain |head -1 >> /tmp/test_ratio.log
- done
- awk '{count[$1]++}END{for(i in count)print i,count[i]}' /tmp/test_ratio.log