1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/bin/bash for device in /sys/class/net/* ; do if [ ! -e $device/flags ]; then continue fi loop=$(($(cat $device/flags) & 0x8 && 1 || 0)) bc=$(($(cat $device/flags) & 0x2 && 1 || 0)) ptp=$(($(cat $device/flags) & 0x10 && 1 || 0)) # Skip any device that is a loopback if [ $loop = 1 ]; then continue fi # Skip any device that isn't a broadcast # or point-to-point. if [ $bc = 0 ] && [ $ptp = 0 ]; then continue fi DEVICE="$DEVICE $(basename $device)" done echo $DEVICE |