Skip to content

Commit

Permalink
Merge pull request #320 from wisscot/temperature_in_weather_fix
Browse files Browse the repository at this point in the history
bug fix: temperature not showing for certain weather info

many thanks to @wisscot for his contribution!
  • Loading branch information
Theoreticallyhugo authored Jan 4, 2025
2 parents 4a5f262 + cc5e11e commit 1f7f091
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/weather.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ display_weather()
fi
weather_information=$(fetch_weather_information $display_weather)

weather_condition=$(echo $weather_information | rev | cut -d ' ' -f2- | rev) # Sunny, Snow, etc
temperature=$(echo $weather_information | rev | cut -d ' ' -f 1 | rev) # +31°C, -3°F, etc
weather_condition=$(echo "$weather_information" | awk -F' -?[0-9]' '{print $1}' | xargs) # Extract condition before temperature, e.g. Sunny, Snow, etc
temperature=$(echo "$weather_information" | grep -oE '[-+]?[0-9]+°[CF]') # Extract temperature, e.g. +31°C, -3°F, etc
unicode=$(forecast_unicode $weather_condition)

# Mac Only variant should be transparent on Linux
Expand Down

0 comments on commit 1f7f091

Please sign in to comment.