From bb20acab34a1480d9cc2f881f3e42c7bdfd28a21 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 28 Feb 2021 01:23:33 -0600 Subject: [PATCH] Fix a bunch of bugs with the incomplete impl of packetloss --- packetloss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packetloss b/packetloss index c139fcc..1173e99 100755 --- a/packetloss +++ b/packetloss @@ -5,7 +5,7 @@ declare -a servers=('1.1.1.1' '8.8.8.8') declare -i highestloss=0 declare -i alltimehighest=0 -declare -i alltimelowest=0 +declare -i alltimelowest=100 declare -i iterations=1 while :; do @@ -23,6 +23,12 @@ while :; do if (( highestloss > 0 )); then color="\e[31m" fi + if (( highestloss > alltimehighest )); then + alltimehighest="$highestloss" + fi + if (( highestloss < alltimelowest )); then + alltimelowest="$highestloss" + fi printf "\\rCurrent loss: $color%-3.3s\e[0m - \e[33m%-4.4s \e[34m%-4.4s \e[0m%-4.4s" \ "$highestloss" \ "$alltimehighest" \