Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rtt() { local h="$1" c="${2:-1}"; if [ -z "$h" ]; then return 1; fi; printf "%s %s\n" "$h" "$(ping -W1 -c "$c" "$h" | awk '/rtt/{ gsub("/", " ", $4); print $4 }')"; };
- sort-by-rtt() { mapfile hosts; while read -r h _; do rtt "$h" & done < <(printf "%s\n" "${hosts[@]}") | sort -nk2; wait; }
- # sort-by-rtt < <( awk '{print $2}' ~/.hosts | shuf -n3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement