#!/bin/sh HOST=www.apple.com ping -t3 -o $HOST &> /dev/null if test "${?}" = 0 then NET=true NETOLD=true say The network connection is available. else NET=false NETOLD=false say No Network connection available. fi while true do ping -t4 -o $HOST &> /dev/null if test "${?}" = 0 then NET=true else NET=false fi #echo NEW $NET OLD $NETOLD if [ $NET != $NETOLD ] then if [ $NET = true ] then say network connection available. else say lost network connection. fi fi NETOLD=$NET sleep 3 done