only show forecast if different than current

This commit is contained in:
Cyryl Płotnicki 2022-12-14 22:57:07 +00:00
parent d116b12827
commit cdcac4d51e

View file

@ -86,7 +86,9 @@ if [ -n "$current" ] && [ -n "$forecast" ]; then
forecast_temp=$(echo "$forecast" | $JQ ".list[].main.temp" | $CUT -d "." -f 1)
forecast_feels=$(echo "$forecast" | $JQ ".list[].main.feels_like" | $CUT -d "." -f 1)
forecast_icon=$(echo "$forecast" | $JQ -r ".list[].weather[0].icon")
echo "$suburb, $city: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL => $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
if [ "$current_temp" -ne "$forecast_temp" ]; then
echo "$suburb, $city: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL => $(get_icon "$forecast_icon") $forecast_temp($forecast_feels)$SYMBOL"
else
echo "$suburb, $city: $current_text $(get_icon "$current_icon") $current_temp($current_feels)$SYMBOL"
fi
fi