while true; do ping -c1 www.google.com > /dev/null && break; done
or
while ! ping -c1 www.google.com &>/dev/null; do :; done
while true; do ping -c1 www.google.com > /dev/null && break; done
or
while ! ping -c1 www.google.com &>/dev/null; do :; done