然后判断这个mac地址是哪个厂商的。方法是看前三段是不是如下所示的。如果不在这里里面,就表面unknown
00:00:0C Cisco
00:00:43 Microtech
00:00:97 EMC
10:40:F3 Apple
2C:41:38 Hewlett Packard
00:24:E8 Dell
00:0D:72 2Wire
00:10:4B 3Com
3 个解决方案
#1
mac=`grep "$1" mac.list`
if [ -z "$mac" ]
then
mac="UNKONWN"
fi
echo $mac
#2
echo "$mac" |cut -d" " -f2
#3
#!/bin/bash
echo Please input your MAC [eg, 00:00:0C:88:AA:55]:
read macStr
macPre=`echo $macStr | cut -d":" -f1-3`
case $macPre in
00:00:0C) echo Cisco;;
00:00:43) echo Microtech;;
00:00:97) echo EMC;;
10:40:F3) echo Apple;;
2C:41:38) echo Hewlett Packard;;
00:24:E8) echo Dell;;
00:0D:72) echo 2Wire;;
00:10:4B) echo 3Com;;
*) echo unknown
esac
#1
mac=`grep "$1" mac.list`
if [ -z "$mac" ]
then
mac="UNKONWN"
fi
echo $mac
#2
echo "$mac" |cut -d" " -f2
#3
#!/bin/bash
echo Please input your MAC [eg, 00:00:0C:88:AA:55]:
read macStr
macPre=`echo $macStr | cut -d":" -f1-3`
case $macPre in
00:00:0C) echo Cisco;;
00:00:43) echo Microtech;;
00:00:97) echo EMC;;
10:40:F3) echo Apple;;
2C:41:38) echo Hewlett Packard;;
00:24:E8) echo Dell;;
00:0D:72) echo 2Wire;;
00:10:4B) echo 3Com;;
*) echo unknown
esac