On Dec 27, 2010 7:54 AM, "Joe" wrote:
>
> On Sun, 26 Dec 2010 23:57:42 +
> Chris Davies wrote:
>
> > S Mathias wrote:
> > > ping -W 1 -c 4 google.com >& /dev/null | grep "100% packet loss"
> > > ping -W 1 -c 4 www.yahoo.com >& /dev/null | grep "100% packet loss"
> >
> > > both sides "false",
Jasper Noë wrote:
> >$ ping -c 4 -w 4 google.com &> /dev/null && ping -c 4 -w 4 www.yahoo.com &>
> >/dev/null || echo "no internet connection"
>
> But, but, ... if the ping to google succeeds, and the ping to yahoo
> fails, it prints "no internet".
>
> $ ping -c 4 -w 4 google.com &> /dev/null ||
On Sun, 26 Dec 2010 14:30:36 -0800, S Mathias wrote:
(...)
> ping -W 1 -c 4 google.com >& /dev/null | grep "100% packet loss" $
> ping -W 1 -c 4 www.yahoo.com >& /dev/null | grep "100% packet loss" $
>
>
>
> ...both sides "false", because they have no output, because google.com
> and www.yahoo
$ ping -c 4 -w 4 google.com &> /dev/null && ping -c 4 -w 4 www.yahoo.com &> /dev/null ||
echo "no internet connection"
But, but, ... if the ping to google succeeds, and the ping to yahoo
fails, it prints "no internet".
$ ping -c 4 -w 4 google.com &> /dev/null || ping -c 4 -w 4 www.yahoo.com
On Sun, 26 Dec 2010 23:57:42 +
Chris Davies wrote:
> S Mathias wrote:
> > ping -W 1 -c 4 google.com >& /dev/null | grep "100% packet loss"
> > ping -W 1 -c 4 www.yahoo.com >& /dev/null | grep "100% packet loss"
>
> > both sides "false", because they have no output, because google.com
> > an
S Mathias wrote:
> perfect! thank you Oliver Grawert! :) made my day :) it's working! :
>
> ping -W 1 -c 4 google.com >& /dev/null && ping -W 1 -c 4 www.yahoo.com >&
> /dev/null || echo "no internet connection"
The ping documentation says:
-c count
Stop after sending count
S Mathias wrote:
> $ true && true || echo hi
Both true commands invoked. This satisfied the left hand side of the
or and so echo was not invoked.
> $ true && false || echo hi
> hi
Both true and false invoked, and then the echo.
> $ false && true || echo hi
> hi
Only the first false invoked, a
S Mathias wrote:
> ping -W 1 -c 4 google.com >& /dev/null | grep "100% packet loss"
> ping -W 1 -c 4 www.yahoo.com >& /dev/null | grep "100% packet loss"
> both sides "false", because they have no output, because google.com
> and www.yahoo.com is reachable.
Or because your local system is so off
2010/12/26 S Mathias :
> $ true && true || echo hi
> $ true && false || echo hi
> hi
> $ false && true || echo hi
> hi
> $ false && false || echo hi
> hi
Hi I was trying with this logic of the internet connection checker script.
If $ true && true || echo hi <<< All right
if $ true && false ||
perfect! thank you Oliver Grawert! :) made my day :) it's working! :
ping -W 1 -c 4 google.com >& /dev/null && ping -W 1 -c 4 www.yahoo.com >&
/dev/null || echo "no internet connection"
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe"
On Sun, 26 Dec 2010, S Mathias writes:
> $ ping -W 1 -c 4 google.com >& /dev/null | grep -q "100% packet loss" && ping
> -W 1 -c 4 www.yahoo.com >& /dev/null | grep -q "100% packet loss" || echo "no
> internet connection"
> no internet connection
>
> ...both sides "false", because they have no o
$ true && true || echo hi
$ true && false || echo hi
hi
$ false && true || echo hi
hi
$ false && false || echo hi
hi
$ ping -W 1 -c 4 google.com >& /dev/null | grep -q "100% packet loss" && ping
-W 1 -c 4 www.yahoo.com >& /dev/null | grep -q "100% packet loss" || echo "no
internet connection"
no
12 matches
Mail list logo