You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
511 B

#!/bin/bash
servers=('nbg.icmp.hetzner.com' 'fsn.icmp.hetzner.com' 'hel.icmp.hetzner.com' 'ash.icmp.hetzner.com' 'dismyserver.net')
names=('Nuremberg' 'Falkenstein' 'Helsinki' 'Ashburn, VA' 'OVH Canada')
regex="time=[0-9 \.]+ms"
for index in $(seq 0 $((${#servers[@]}-1))); do
domain=${servers[$index]}
name=${names[$index]}
pingdata=`ping -c1 ${domain}`
delay=`echo -e $pingdata | egrep -o "${regex}"`
[ ${#domain} -lt 20 ] && tabs="\t\t" || tabs="\t"
echo -e "${name}\t${domain}${tabs}${delay}"
done