Advertisement
Guest User

osrs ping bash

a guest
Jun 28th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. c=1
  2. if [ -n "$1" ]; then
  3.     c="$1"
  4.     echo -e "Averaging over "$c" attempts:\n"
  5. fi
  6.  
  7. for world in {1..94}
  8. do
  9.     case "$world" in
  10.         # skip worlds that don't exist:
  11.         63|64|71|72|79|80)
  12.             continue
  13.             ;;
  14.         # ping all others $c times and report average
  15.         *)
  16.             ping_time=$(ping -c "$c" oldschool${world}.runescape.com | tail -1 | awk -F '/' '{print $5}')
  17.             echo "World ${world}: ${ping_time} ms"
  18.             ;;
  19.     esac
  20. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement