diff --git a/.config/xfce4/panel/scripts/netstatus.sh b/.config/xfce4/panel/scripts/netstatus.sh index 8ef7cd0..e0c2f49 100755 --- a/.config/xfce4/panel/scripts/netstatus.sh +++ b/.config/xfce4/panel/scripts/netstatus.sh @@ -9,11 +9,11 @@ function doPing () { } function get_ip_addresses() { - ip -4 -json address | jq -r ' -map(select(.ifname != "lo") | + ip -4 -json address | jq -r --arg ifregex "${1:-lo}" ' +map(select(.ifname | test($ifregex) | not) | .ifname + ":" + (.addr_info | map(.local) | join(","))) | join(" ") ' } -echo -n "$(get_ip_addresses) $(doPing 8.8.8.8 G)" +echo -n "$(get_ip_addresses "$1") $(doPing 8.8.8.8 G)"