[ltp] OT: how to time a ping command?

André Wyrwa linux-thinkpad@linux-thinkpad.org
Tue, 21 Sep 2004 01:32:24 +0200


Hi,

> I did something much faster (which I can't recall verbatim).  It would do 
> something like
> 
> ping -c 1 somehost > /dev/null &
> ping_pid=$!
> { sleep 1 ; kill $ping_pid ; } &
> sleep_pid=$!
> wait $ping_pid
> kill -0 $sleep_pid && # internet connection is up
> kill $sleep_pid

Yes, this looks better. I took this and adopted it. Thanks a lot for all
replies.

André.