用tcptraceroute程式來平均回應的秒數

#!/bin/bash

export LANG=C

if [ -z $1 ]; then
        echo "plz input remote IP address" && exit 0
else
        if [ -f /usr/local/bin/tcptraceroute ]; then
                result_value=`tcptraceroute $1 | grep $1 | awk '{print $5" "$7" "$9}'`
                set — $result_value
                var1=`echo $1 | cut -d'.' -f1`
                var2=`echo $2 | cut -d'.' -f1`
                var3=`echo $3 | cut -d'.' -f1`

                sum=`expr $var1 + $var2 + $var3`

                avg=`expr $sum / 3`
                echo $avg
        else
                echo "" && echo "Warnning!!!" && echo "plz first install tcptraceroute To /usr/local/bin" && echo "" || exit 0
        fi
fi

Related posts 相關文章

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。