bin sh ping_result packet_lose 100 ip 10 20 48 70 while packet_lose -g

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#! /bin/sh
ping_result=
packet_lose=100
ip=10.20.48.70
while [ $packet_lose -gt 2 ]; do
packet_lose=$(ping -A $ip -c 50 -q | tail -n2 | sed -rn 's#.*,\s([0-9]+)% packet loss.*#\1#p')
echo "packet loss: $packet_lose"
done
aplay ~/alert.wav