bash: check for network

Dan Wilson dan at
Thu Apr 14 09:39:51 MDT 2005

Hey all,

I've got a cron script that connects to a remote server to accomplish a
few tasks.  I run this on my laptop and sometimes don't have a network
connection.  If there is no connection, I just end up getting a bunch of
emails stuck in the queue and eventually sent to me that say it couldn't
connect to the server.

So within my script, I'd like to be able to check if I have a network
connection prior to starting my tasks.

I'm sure there is an easy way to do this (without too much awk, sed and
grepping, etc).  Any ideas?


More information about the PLUG mailing list