refactor: add check for 'shuf' inside 'check_command' function

This commit is contained in:
hugmouse 2024-06-19 18:59:04 +02:00
commit fdf136e464
No known key found for this signature in database
GPG key ID: 45FDB5FAB7ECB522

View file

@ -786,6 +786,7 @@ function iperf_test {
# attempt the iperf send test 3 times, allowing for a slot to become available on the # attempt the iperf send test 3 times, allowing for a slot to become available on the
# server or to throw out any bad/error results # server or to throw out any bad/error results
if check_command "shuf"; then
I=1 I=1
while [ $I -le 3 ] while [ $I -le 3 ]
do do
@ -836,6 +837,9 @@ function iperf_test {
fi fi
echo -en "\r\033[0K" echo -en "\r\033[0K"
done done
else
echo -e "\nWarning: 'shuf' command not found. Skipping iperf network tests..."
fi
# Run a latency test via ping -c1 command -> will return "xx.x ms" # Run a latency test via ping -c1 command -> will return "xx.x ms"
[[ -n $LOCAL_PING ]] && LATENCY_RUN="$(ping -c1 "$URL" 2>/dev/null | grep -o 'time=.*' | sed s/'time='//)" [[ -n $LOCAL_PING ]] && LATENCY_RUN="$(ping -c1 "$URL" 2>/dev/null | grep -o 'time=.*' | sed s/'time='//)"