How to fetch the logical name of a NIC card given the ip address associated with it ? How to fetch the logical name of a NIC card given the ip address associated with it ? shell shell

How to fetch the logical name of a NIC card given the ip address associated with it ?


Take this:

#!/bin/ship=192.168.1.10iface=$(ip addr | grep $ip | awk '{print $NF}')echo "Iface is: ${iface}"