_mac_addresses: Fix with net-tools' ifconfig that outputs ether, not HWaddr.

This commit is contained in:
Ville Skyttä 2013-02-01 19:35:55 +02:00
parent cee32c6424
commit f6df76e8ca

View File

@ -821,10 +821,12 @@ _mac_addresses()
local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'
local PATH="$PATH:/sbin:/usr/sbin"
# Local interfaces (Linux: HWAddr, FreeBSD: ether)
# Local interfaces (Linux: HWaddr or ether, FreeBSD: ether)
COMPREPLY+=( $( ifconfig -a 2>/dev/null | sed -ne \
"s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne \
"s/^[[:space:]]\{1,\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" \
"s/.*[[:space:]]ether[[:space:]]\{1,\}\($re\)[[:space:]].*/\1/p" -ne \
"s/.*[[:space:]]ether[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p"
) )
# ARP cache