Gerald Pfeifer wrote:

> On Wed, 26 Jul 2000, David Elliott wrote:
> > Easy in bash:
> > if /sbin/route -n | grep "^0.0.0.0"
> > then
> >     echo "Nothin' but 'net"
> > else
> >     echo "Please connect to the 'net"
> > fi
>
> Sorry, not all the world is Linux:
>

Yes, that is correct

>
>   gomeisa[53]:~% /sbin/route -n ; uname -rs
>   /sbin/route: Command not found.
>   SunOS 5.6
>

Okay, that's odd. Where do they hide the route command

>
>   taygeta[44]:~% /sbin/route -n ; uname -rs
>   usage: route [-dnqtv] command [[modifiers] args]
>   FreeBSD 4.0-RELEASE
>

okay, so route -n print I am assuming?

A configure test of the route command would take care of the differences nicely.

Can I assume that the grep part should work on any self respecting UNIX ?

Of course now I am going to have people bitching about non-UNIX ports.  My answer
to that is to implement the function a totally different way, perhaps using a
similar service provided by the OS if available.  But since UNIX doesn't have
anything close to InternetCheckConnection, I think grepping the output of route is
an easy way to check.

-Dave

Reply via email to