#! /bin/bash declare -A icon icon["01d"]="" # Clear sky day. icon["01n"]="" # Clear sky night. icon["02d"]="" # Few clouds day. icon["02n"]="" # Few clouds night. icon["03d"]="" # Scattered clouds day. icon["03n"]="" # Scattered clouds night. icon["04d"]="" # Broken clouds day. icon["04n"]="" # Broken clouds night. icon["09d"]="" # Shower rain day. icon["09n"]="" # Shower rain night. icon["10d"]="" # Rain day. icon["10n"]="" # Rain night icon["11d"]="" # Thunderstorm day. icon["11n"]="" # Thunderstorm night icon["13d"]="" # Snow day. Snowflake alternative:  icon["13n"]="" # Snow night. Snowflake alternative:  icon["50d"]="" # Mist day. icon["50n"]="" # Mist night json=$(curl "https://api.openweathermap.org/data/2.5/weather?&units=metric&id=YourCityIdHere&appid=YouAPIKeyHere") i=$(echo $json | jq -c -r '.weather[0].icon') ico="${icon[$i]}" echo $json | jq -c --arg icon "$ico" '.weather[0].icon = $icon'