Quote:
Originally Posted by Neville Hillyer
This is the easiest way I can find to do it in OS X:
while read x y; do [ $x = ether ] && echo $y; done < <(ifconfig)
|
That was... unexpected!!!
I have never seen a while loop being used for that purpose. An easier (in my humble opinion) way to get all the MAC addresses is:
Code:
ifconfig | grep ether | awk '{ print $2 }'
3c:08:14:6e:fc:00
4c:c2:a9:1d:12:dd
0e:c2:a9:4d:52:dd
Or, if you only want the MAC address for a specific device, try:
Code:
ifconfig en0 | grep ether | awk '{ print $2 }'
1c:17:04:3f:ac:00
The above commands have been executed under OS X 10.7.
I know nothing about BusyBox though.
Best regards,
HMW
PS. Since I am paranoid, I have spoofed the addresses. DS