#!/bin/sh dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) for sp in $(shuf $dir/iperf3-servers.txt); do printf "Trying %s...\n" "$sp" srv="${sp%:*}" port="${sp#*:}" iperf3 -c $srv -p $port && break done