From f6df76e8cac6ae47b93c87d594d70dab211b860a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 1 Feb 2013 19:35:55 +0200 Subject: [PATCH] _mac_addresses: Fix with net-tools' ifconfig that outputs ether, not HWaddr. --- bash_completion | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index 9412580b..f559f9b4 100644 --- a/bash_completion +++ b/bash_completion @@ -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