#!/bin/bash #jweather=$( curl --silent wttr.in/?format=j1 ) jweather=$( cat ~/weather.json ) current_f=$( jq -r '.current_condition.[].FeelsLikeF' <<< ${jweather} ) high_f=$( jq -r '.weather.[0].maxtempF' <<< ${jweather} ) low_f=$( jq -r '.weather.[0].mintempF' <<< ${jweather} ) weather_desc=$( jq -r '.current_condition.[].weatherDesc.[].value' <<< ${jweather} ) hourly_forecast="" daily_forecast="" current_hour=$( date +'%H' ) echo $current_hour for h in {0..7};do check_hour=$( date -d $( jq -r --argjson h ${h} '.weather.[0].hourly.[$h].time' <<< ${jweather} ) +'%H' ) if [[ ${check_hour#0} -ge ${current_hour#0} ]];then echo "future" hourly_forecast="${hourly_forecast}\n${check_hour}"$( jq -r --argjson h ${h} '.weather.[0].hourly.[$h]..FeelsLikeF' <<< ${jweather} ) fi # hourly_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F" done exit for d in {1..2};do daily_forecast="${forecast}\n"$( date -d $( jq -r --argjson d ${d} '.weather.[$d].date' <<< ${jweather} ) +'%a' )": High "$( jq -r --argjson d ${d} '.weather.[$d].maxtempF' <<< ${jweather} )"°F, Low"$( jq -r --argjson d ${d} '.weather.[$d].mintempF' <<< ${jweather} )"°F" done forecast=$( echo -e $forecast ) # | sed '/^[[:space:]]*$/d' ) notify-send "${weather_desc}, ${current_f}°F High: ${high_f}°F | Low: ${low_f}°F ${daily_forecast}"