#!/bin/sh API_KEY="$(cat ~/.config/openweathermap)" ZIP_CODE=23435 while read line do case $line in icon*) case "${line#icon }" in 01d) ICON=󰖙 ;; 01n) ICON=󰖔 ;; 02d) ICON=󰖕 ;; 02n) ICON=󰼱 ;; 03*|04*) ICON=󰖐 ;; 09*|10*) ICON=󰖗 ;; 11*) ICON=󰖓 ;; 13*) ICON=󰖘 ;; 50*) ICON=󰖑 ;; esac #printf "$ICON" ;; description*) #printf "${line#description }" DESCRIPTION="${line#description }" ;; humidity*) #printf "󰖎%.2d%% " "${line#humidity }" HUMIDITY="${line#humidity }" ;; feels_like*) #printf "%2.1f℉ " "${line#feels_like }" FEELS_LIKE="${line#feels_like }" ;; esac done << EOF $(fetch -qo - "https://api.openweathermap.org/data/2.5/weather?zip=$ZIP_CODE&units=imperial&appid=$API_KEY" \ | tr -d '"{}[]' \ | tr ',' '\n' \ | tr ':' ' ') EOF printf "%s%s %2.1f℉ 󰖎%.2d%%\n" "$ICON" "$DESCRIPTION" "$FEELS_LIKE" "$HUMIDITY"