G'day,
I am not quite sure, but I think the problem is your operator. && tests if the previous command ran successfully, and in my understanding the command "ping" returns success to bash regardless of the result of the ping. The command "ping" returns failure if something broke the program itself I guess.
I think this might help you more: https://stackoverflow.com/questions/12669150/ping-batch-file-with-condition
Regards,