#!/bin/sh : HTTP APIs that return your public IP address [both v4 and v6] "\ https://icanhazip.com https://ifconfig.io http://icanhazip.com http://ifconfig.io/ " PUBLIC_IP_FETCH_URL="https://icanhazip.com" PUBLIC_IP6_FETCH_URL="$PUBLIC_IP_FETCH_URL" printf '%s\ts\n' \ "$(curl -4 --connect-timeout 5 --silent "$PUBLIC_IP_FETCH_URL")" \ "$(curl -6 --connect-timeout 5 --silent "$PUBLIC_IP6_FETCH_URL")" \ | sed -e 's/ \/ $//' \ -e 's/^ \/ //' \ -e 's/^$/[error fetching address]/'