This Bash script fetches current weather information using the WeatherAPI and displays relevant details in the terminal.
- Fetches weather information for a specified city using the WeatherAPI.
- Checks for internet connectivity before making the API request.
- Displays current weather details, including temperature, wind speed, humidity, and more.
- Can be run automatically on machine startup.
- Bash (Linux/Unix-like environment)
- jq - A lightweight and flexible command-line JSON processor.
-
Clone the repository:
git clone https://github.com/hima890/weatherInformation_bash.git
-
Move into the project directory:
cd weatherInformation_bash
-
Make the script executable:
chmod +x main.sh
-
Configure your API key and city in the
config.txt
file:# Using Free api from "https://www.weatherapi.com/" # Add the API key to get access to the data API_KEY="<Write-your-key-here>" # Set the option for air quality API_OP="no" # Set the target city City="<Write-your-city-here>"
-
Run the script:
./main.sh
This will display the current weather information for the specified city.
To run the script automatically every time you start your machine, follow the instructions in the Autostart section below.
To make the script run automatically on machine startup, add the following line to your shell configuration file (e.g., ~/.bashrc
, ~/.zshrc
, or equivalent):
export PATH="$PATH:/path/to/weatherInformation_bash"
Replace /path/to/weatherInformation_bash
with the actual path to the project directory.
This project is licensed under the MIT License - see the LICENSE file for details.
Please note that you should replace placeholders such as `<Write-your-key-here>` and `<Write-your-city-here>` with actual values in your `config.txt` file. Additionally, modify the installation and usage instructions based on the specific requirements of your project.