PC with onboard linux has several network interfaces, e.g. two ethernet cards and one wifi adapter (numbers and types may vary). Each of that interfaces could be connected to a network (and could be offline) and the network could be connected to internet(superuser.com site is reachable), and could be connected to local-only network.
I want to write a bash script to get (local) IP address and name of adapter that can be used to reach internet.
If several are connected - it should be the one that would be used by browser that is "asked" to load superuser.com web pages. If no connected script should
echo "internet unavailble"
How to write a check condition for such script?
How could i even iterate all networking-capable devices under
/dev/* in a system?