#!/bin/sh quiet=0 if [[ "$1" == "-q" ]] then quiet=1 shift fi tmp=`tempfile -m 0600` slept=0 while true do monlist=$( ntpdc "$@" 2>&1 >$tmp ) rc=$? if echo "$monlist" | grep "Response from server was incomplete" >/dev/null 2>&1 then [[ $quiet -eq 0 ]] && echo -n "*" 1>&2 sleep .5 slept=1 else [[ $slept -eq 1 && $quiet -eq 0 ]] && echo 1>&2 [[ -n "$monlist" ]] && echo "$monlist" 1>&2 [[ -s $tmp ]] && cat $tmp rm $tmp exit $rc fi done