I have this shell script which keeps running continously.
#!/bin/sh
while true;
do ping -c1 www.google.com > /dev/null;
done
When I disconnect my lan cable this script throws error in the terminal
ping: unknown host www.google.com
but it takes some time to throw the error.
I want it to throw the error instantly even if I disconnect my lan cable for a few milliseconds and then connect it quickly. How do I do it?