#!/bin/bash function doPing () { # $1 = target # $2 = letter ping -c1 -W1 "$1" | \ (grep "bytes from" || echo "$2:Down") | \ sed 's/.*time=\([0-9\.]*\).*/'"$2"':\1ms/' } function get_ip_addresses() { ip -4 -json address | jq -r ' map(select(.ifname != "lo") | .ifname + ":" + (.addr_info | map(.local) | join(","))) | join(" ") ' } echo -n "$(get_ip_addresses) $(doPing 8.8.8.8 G)"