If you are speaking of a VPN used to access a private network, perhaps the easiest approach would be to check if an IP address specific to that network is reachable.
For example, if your VPN connects you to a network 192.168.100.0/24, using
ping to check if 192.168.100.1 (probably the gateway) is reachable:
if ping -c 4 192.168.100.1 &> /dev/null
echo "not connected"
Solution copied from this answer (in my example,
-c 4 tries 4 times).
If you are using a VPN to avoid blocking, you might instead test against any IP address that is otherwise blocked.
This approach is not very sophisticated, but its advantage is its simplicity, and that it should work independent from the type of VPN and also on most operating systems.