netstatus: Re-enable filtering interfaces by regex from script argument

This commit is contained in:
Adam Goldsmith 2022-10-04 13:03:01 -04:00
parent cce8cf0917
commit 55c60257c1

View File

@ -9,11 +9,11 @@ function doPing () {
} }
function get_ip_addresses() { function get_ip_addresses() {
ip -4 -json address | jq -r ' ip -4 -json address | jq -r --arg ifregex "${1:-lo}" '
map(select(.ifname != "lo") | map(select(.ifname | test($ifregex) | not) |
.ifname + ":" + (.addr_info | map(.local) | join(","))) | .ifname + ":" + (.addr_info | map(.local) | join(","))) |
join(" ") join(" ")
' '
} }
echo -n "<txt>$(get_ip_addresses) $(doPing 8.8.8.8 G)</txt>" echo -n "<txt>$(get_ip_addresses "$1") $(doPing 8.8.8.8 G)</txt>"