rwxrob-dot/scripts/ips

19 lines
263 B
Plaintext
Raw Normal View History

2022-02-09 07:29:05 +00:00
#!/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