3 # Checks if the given interface matches the given ethernet MAC.
4 # If it does it exits with 0 (success) status;
5 # if it doesn't then it exists with 1 (error) status.
12 echo "Usage: $0 IFACE targetMAC"
16 targetmac=`echo "$2" | sed -e 'y/ABCDEF/abcdef/'`
17 mac=$(/sbin/ifconfig "$iface" | sed -n -e '/^.*HWaddr \([:[:xdigit:]]*\).*/{s//\1/;y/ABCDEF/abcdef/;p;q;}')
19 if [ "$targetmac" = "$mac" ]; then exit 0; else exit 1; fi