Skip to content

A simple Bash script that fetches and displays current weather information for a specified city using the WeatherAPI. The script checks for internet connectivity, sources configuration from a config.txt file, and provides details such as temperature, wind speed, humidity, and more. Optionally, it can be configured to run automatically on startup

Notifications You must be signed in to change notification settings

hima890/weatherInformation_bash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Weather Image

Weather Information Bash Script

This Bash script fetches current weather information using the WeatherAPI and displays relevant details in the terminal.

Features

  • 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.

Getting Started

Prerequisites

  • Bash (Linux/Unix-like environment)
  • jq - A lightweight and flexible command-line JSON processor.

Installation

  1. Clone the repository:

    git clone https://github.com/hima890/weatherInformation_bash.git
  2. Move into the project directory:

    cd weatherInformation_bash
  3. Make the script executable:

    chmod +x main.sh

Usage

  1. 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>"
  2. Run the script:

    ./main.sh

    This will display the current weather information for the specified city.

Automating Script Execution on Startup

To run the script automatically every time you start your machine, follow the instructions in the Autostart section below.

Autostart

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.

License

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.

About

A simple Bash script that fetches and displays current weather information for a specified city using the WeatherAPI. The script checks for internet connectivity, sources configuration from a config.txt file, and provides details such as temperature, wind speed, humidity, and more. Optionally, it can be configured to run automatically on startup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages