Marcus Meissner wrote:

> On Tue, Jul 25, 2000 at 10:14:25AM -0500, Aric Stewart wrote:
> > This implements InternetCheckConnection. Because i cannot do it properly
> > i had to use a kludge where i call ping via a system call. Explanation
> > as well as the way i wanted to to the ping are in the code.
>
> I have doubts about this is being a good idea.
>

[snip]

>
> Parse output of:
>         /sbin/ifconfig  - for occurences of ppp*, eth* or similar.
>                         - for occurences of non 127.* addresses.
>         /sbin/route -n  - dito
>
> Ciao, Marcus

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

All it does is check for 0.0.0.0 at the beginning of a line from the output
of route.  That means that a default route has been established which should
mean an internet connection is supposed to be up.

-Dave

Reply via email to