Greg Wooledge:

wooledg:~$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode 
DEFAULT group default qlen 1
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP 
mode DEFAULT group default qlen 1000
     link/ether a0:8c:fd:c3:89:e0 brd ff:ff:ff:ff:ff:ff
Parsing the interface names out of THAT is significantly harder.


In support of my earlier point that some /other/ people /did/ make modern |ifconfig| usable in such ways:
JdeBP % ifconfig -l
bge0 bge1 lo0 tun0
JdeBP %

Here's something from a script of mine:
list_available_network_interfaces() {
         case "`uname`" in
         Linux)  /bin/ls /sys/class/net ;;
         *)      ifconfig -l ;;
         esac
}

(Note that this is as loose as it is because I'm only targetting Linux-based operating systems and the BSDs so far here. Also note that this breaks on OpenBSD which does not have the |-l| option to |ifconfig|. Fixing that is on the to-do list.)

Reply via email to