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

This commit is contained in:
Ville Skyttä 2013-02-01 20:27:07 +02:00
parent b78ef321be
commit aa516acdc5

View File

@ -875,10 +875,11 @@ _configured_interfaces()
# #
_ip_addresses() _ip_addresses()
{ {
local PATH=$PATH:/sbin
COMPREPLY+=( $( compgen -W \ 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' \ sed -ne 's/.*addr:\([^[:space:]]*\).*/\1/p' \
-ne 's/.*inet[[:space:]]\{1,\}\([^[:space:]]*\).*/\1/p' )" \ -ne 's|.*inet[[:space:]]\{1,\}\([^[:space:]/]*\).*|\1|p' )" \
-- "$cur" ) ) -- "$cur" ) )
} }