#!/bin/sh -e proto=$1 shift [ "$proto" = "6" ] || proto="" if ping${proto} -c 1 $@ > state/ping-out ; then tail -1 < state/ping-out else cat state/ping-out exit 1 fi