Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hima890/weatherinformation_bash
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
https://github.com/hima890/weatherinformation_bash
bash-automation bash-script weather-api
Last synced: about 1 month ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/hima890/weatherinformation_bash
- Owner: hima890
- Created: 2023-11-22T11:45:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-22T14:24:20.000Z (about 1 year ago)
- Last Synced: 2024-11-13T13:45:40.217Z (3 months ago)
- Topics: bash-automation, bash-script, weather-api
- Language: Shell
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Weather Image](image.jpg)
# Weather Information Bash Script
This Bash script fetches current weather information using the [WeatherAPI](https://www.weatherapi.com/) 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](https://stedolan.github.io/jq/) - A lightweight and flexible command-line JSON processor.### Installation
1. Clone the repository:
```bash
git clone https://github.com/hima890/weatherInformation_bash.git
```2. Move into the project directory:
```bash
cd weatherInformation_bash
```3. Make the script executable:
```bash
chmod +x main.sh
```### Usage
1. Configure your API key and city in the `config.txt` file:
```bash
# Using Free api from "https://www.weatherapi.com/"# Add the API key to get access to the data
API_KEY=""
# Set the option for air quality
API_OP="no"
# Set the target city
City=""
```2. Run the script:
```bash
./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](#autostart) 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):
```bash
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](LICENSE) file for details.
```
Please note that you should replace placeholders such as `` and `` with actual values in your `config.txt` file. Additionally, modify the installation and usage instructions based on the specific requirements of your project.