#!/bin/bash weather=$(curl -4 -sS --connect-timeout 3 --max-time 8 "https://wttr.in/?format=%c%t" 2>/dev/null) if [ -z "$weather" ] || printf '%s' "$weather" | grep -q "Unknown"; then printf '%s\n' '{"text":"N/A"}' exit 0 fi printf '{"text":"%s"}\n' "$weather"