#!/bin/sh set -e [ -n "$DEBUG" ] && set -x loc=$1 if [ -n "$REPORT" ]; then curl -s v2.wttr.in/"${loc}"?F | less exit 0 fi curl -s wttr.in/"${loc}"?format=j1 \ | jq \ --raw-output \ --unbuffered \ --compact-output \ --arg tooltip "$(curl -s v2.wttr.in/"${loc}"?ATFQ | tail -n5)" \ '.current_condition[] | { text: .weatherDesc[0].value, percentage: (.temp_C | tonumber), class: .weatherCode, alt: .weatherCode, tooltip: ($tooltip) }'