summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-11-05 12:09:40 +0200
committerVille Skyttä <ville.skytta@iki.fi>2011-11-05 12:09:40 +0200
commit370a550baf9466b99783b9cca64127190fd9cea2 (patch)
tree58f3d2a4288471228ea99954c19ff7ee05e18be0
parentbfa8425a4a31c0f2948107440b0e351dee90c2d8 (diff)
downloadbash-completion-370a550baf9466b99783b9cca64127190fd9cea2.tar.gz
_mac_addresses: Grab addresses from FreeBSD's ifconfig -a output too.
-rw-r--r--bash_completion6
1 files changed, 4 insertions, 2 deletions
diff --git a/bash_completion b/bash_completion
index 02527690..c5cd7c95 100644
--- a/bash_completion
+++ b/bash_completion
@@ -793,9 +793,11 @@ _mac_addresses()
local re='\([A-Fa-f0-9]\{2\}:\)\{5\}[A-Fa-f0-9]\{2\}'
local PATH="$PATH:/sbin:/usr/sbin"
- # Local interfaces (Linux only?)
+ # Local interfaces (Linux: HWAddr, FreeBSD: ether)
COMPREPLY+=( $( ifconfig -a 2>/dev/null | sed -ne \
- "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" ) )
+ "s/.*[[:space:]]HWaddr[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" -ne \
+ "s/^[[:space:]]\{1,\}ether[[:space:]]\{1,\}\($re\)[[:space:]]*$/\1/p" \
+ ) )
# ARP cache
COMPREPLY+=( $( arp -an 2>/dev/null | sed -ne \