in reply to when no ping say 'moo!'

The ping program actually gives the right exit code, so you can just look at that instead of trying to parse its output.