blob: 61213f379f07be1ad87c9bf7d77ab88ca137c5b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
hping() {
host=`echo $1 | sed -e 's:.*\://::' -e 's:/.*::'`
result=`ping -c3 -q ${host} 2>/dev/null`
if [ -n "$result" ]
then
if [ -z "`echo $result | sed 's:.*0 packets received.*:N:'`" ]
then
result=`echo $result | sed -e "s:.*= [0-9|\.]*/::" -e "s:/[0-9|\.]* ms::" | awk '{ printf ("%04i\n",(atof $1)) }'`
echo $result $1
else
echo 9999 $1
fi
fi
}
pingall() {
for i in $1
do
hping $i
done
}
pingall "$1" | sort | sed -e "s:[0-9]* ::"
#pingall "$1"
|