stow_dotfiles/scripts/.local/bin/weather

28 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
infoweather=$(curl -s 'wttr.in/Ottawa?format=%C:%t&period=60')
IFS=':' read -r condition temperature <<<"$infoweather"
case ${condition} in
"Clear" | "Sunny") condition="" ;;
"Cloudy") condition="" ;;
"Mist" | "Fog") condition="" ;;
"Heavy Rain") condition="" ;;
"HeavyShowers") condition="" ;;
"HeavySnow") condition="" ;;
"HeavySnowShowers") condition="" ;;
"Rain" | "Light Rain") condition="" ;;
"LightShowers") condition="" ;;
"LightSleet") condition="" ;;
"LightSleetShowers") condition="" ;;
"LightSnow") condition="" ;;
"LightSnowShowers") condition="" ;;
"Overcast") condition="" ;;
"Partly cloudy") condition="" ;;
"ThunderyHeavyRain") condition="" ;;
"ThunderyShowers") condition="" ;;
"ThunderySnowShowers") condition="" ;;
"VeryCloudy") condition="" ;;
*) condition="${condition}" ;;
esac
echo -ne "${condition} ${temperature}"