How can an internet connection be tested without pinging some website? I mean, what if there is a connection but the site is down? Is there a check for a connection with the
In Bash, using it's network wrapper through /dev/{udp,tcp}/host/port:
if : >/dev/tcp/8.8.8.8/53; then echo 'Internet available.' else echo 'Offline.' fi
(: is the Bash no-op, because you just want to test the connection, but not processing.)
: