#!/usr/bin/env bash set -euo pipefail # POS: network ip — Show interfaces, routes, public IP + location usage() { cat </dev/null) || true if [ -n "${PUBLIC_IP:-}" ]; then echo "$PUBLIC_IP" GEO=$(curl -4 -s --max-time 5 "http://ip-api.com/json/${PUBLIC_IP}?fields=status,country,regionName,city,isp" 2>/dev/null) || true if [ -n "${GEO:-}" ]; then location=$(echo "$GEO" | python3 -c " import sys, json d = json.load(sys.stdin) if d.get('status') == 'success': print(f\"{d['city']}, {d['regionName']}, {d['country']} ({d['isp']})\") " 2>/dev/null) || true if [ -n "${location:-}" ]; then printf "%-20s %s\n" "Location" "$location" else echo "Location: Unavailable" fi else echo "Location: Unavailable" fi else echo "Unavailable" fi echo