| |
| # Usage: pingstat <target> <duration> [<interval>] |
| if ping.bsd -nq -c 1 -t 2 127.0.0.1 > /dev/null 2>&1; then |
| pingstat() { |
| local interval= |
| [ -n "$3" ] && interval="-i $3" |
| ping.bsd -nqv -t "$2" $interval -- "$1" |
| } |
| elif ping.inetutils --numeric --quiet --count 1 --timeout 2 127.0.0.1 > /dev/null 2>&1; then |
| pingstat() { |
| local interval= |
| [ -n "$3" ] && interval="--interval $3" |
| ping.inetutils --numeric --quiet --timeout "$2" $interval -- "$1" |
| } |
| else |
| ping.iputils -nq -c 1 -w 2 127.0.0.1 > /dev/null 2>&1 && PING=ping.iputils || PING=ping |
| pingstat() { |
| local interval= |
| [ -n "$3" ] && interval="-i $3" |
| $PING -nq -w "$2" $interval -- "$1" |
| } |
| fi |