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 || ping -c 4 -w 4 www.yahoo.com &> > /dev/null || echo "no internet connection"
I think the intent of S Mathias's original was that both sites needed to be up and online or a failure would be reported. I think the intent was that if either one or the other didn't work then report a failure. Because of the included four test cases that showed all four of the possibilities. Your test here changes that behavior. As to whether this is a good idea to do it one way or the other way is a different question. As to whether it should be the other way around with a success being if either ping succeeds that I don't know. I am not sure what this test is being used for. But it is a different test. Bob
signature.asc
Description: Digital signature