From aa516acdc537b14541cb16424d51af6403321705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Fri, 1 Feb 2013 20:27:07 +0200 Subject: [PATCH] _ip_addresses: Try with "ip addr" if ifconfig is not available. --- bash_completion | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index d56644f8..4b581966 100644 --- a/bash_completion +++ b/bash_completion @@ -875,10 +875,11 @@ _configured_interfaces() # _ip_addresses() { + local PATH=$PATH:/sbin COMPREPLY+=( $( compgen -W \ - "$( PATH="$PATH:/sbin" LC_ALL=C ifconfig -a | + "$( { LC_ALL=C ifconfig -a || ip addr show; } 2>/dev/null | sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \ - -ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \ + -ne 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \ -- "$cur" ) ) }