From 27f44c8e7274db461a10b393389556c8280a12a6 Mon Sep 17 00:00:00 2001 From: darkclip Date: Thu, 3 Aug 2023 01:12:16 +0800 Subject: [PATCH] update --- cf-watch.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cf-watch.sh b/cf-watch.sh index 5e3282b9..7e844c42 100755 --- a/cf-watch.sh +++ b/cf-watch.sh @@ -6,8 +6,9 @@ get_rnd(){ }; get_ping_loss(){ - loss_percent=$(ping -c 5 -q $1 | awk '/packet loss/{print $(NF-4)}'); - echo ${loss_percent%?}; + loss_percent=$(ping -c 5 -q $1 | awk '/packet loss/{print $((NF-4))}'); + loss=${loss_percent%?}; + echo ${loss%.*} return $?; };