Skip to content

Commit

Permalink
fix: use iproute2 to get full interface name
Browse files Browse the repository at this point in the history
long interface name may be truncated by ifconfig, prefer iproute2.
See also: scop#1089
  • Loading branch information
hellodword committed Feb 8, 2024
1 parent 79423f0 commit 2c94bf1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -1727,9 +1727,11 @@ _comp_compgen_available_interfaces()
if [[ ${1-} == -w ]]; then
iwconfig
elif [[ ${1-} == -a ]]; then
ifconfig || ip -c=never link show up || ip link show up
# long interface name may be truncated by ifconfig, prefer iproute2.
# See also: https://github.com/scop/bash-completion/issues/1089
ip -c=never link show up || ip link show up || ifconfig
else
ifconfig -a || ip -c=never link show || ip link show
ip -c=never link show || ip link show || ifconfig -a
fi
} 2>/dev/null | _comp_awk \
'/^[^ \t]/ { if ($1 ~ /^[0-9]+:/) { print $2 } else { print $1 } }')" &&
Expand Down

0 comments on commit 2c94bf1

Please sign in to comment.