[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-102-gaa516ac

Ville Skyttä ville.skytta at iki.fi
Fri Feb 1 18:28:42 UTC 2013


The following commit has been merged in the master branch:
commit aa516acdc537b14541cb16424d51af6403321705
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Feb 1 20:27:07 2013 +0200

    _ip_addresses: Try with "ip addr" if ifconfig is not available.

diff --git a/bash_completion b/bash_completion
index d56644f..4b58196 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" ) )
 }
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list