This Bash script fetches the current weather and a 5-day forecast for a specified city using the OpenWeatherMap API. Optionally, it can send the weather report by email.
- Fetches current weather and 5-day forecast for a given city (in Czech).
- Outputs results to a timestamped log file.
- Optionally sends the report by email.
- Basic error handling for API responses and email sending.
- curl
- jq
- msmtp (for email sending)
- OpenWeatherMap API key
-
Clone or download this script.
-
Install required dependencies (on Debian/Ubuntu):
sudo apt-get update sudo apt-get install curl jq msmtp
-
Obtain an API key from OpenWeatherMap.
-
Configure msmtp
Create or edit your~/.msmtprcwith your SMTP credentials (see msmtp docs for help).