You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
263 B
Bash

#!/usr/bin/env bash
getnics () {
while IFS= read -r line; do
echo ${line%% *}
done < <(ip --br -4 a)
}
# complete -W "$(ips)" ips
if [ -z "$1" ]; then
getnics
exit 0
fi
for i in "$1";do
m=$(ip --br -4 a s "$1"); m=${m%\/*}; echo ${m##* }
done