From b738b64a8c14f1de9479aa29ed5586fba5f1f844 Mon Sep 17 00:00:00 2001 From: KeeganForelight Date: Fri, 13 Jan 2023 16:38:21 -0500 Subject: [PATCH] fixed weather search --- server_weather.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server_weather.sh b/server_weather.sh index dce019a..e38f9b7 100755 --- a/server_weather.sh +++ b/server_weather.sh @@ -25,12 +25,12 @@ get_weather() { LAT=$(echo "$COORDS" | awk -F , '{print $1}') LON=$(echo "$COORDS" | awk -F , '{print $2}') - url="https://api.openweathermap.org/data/2.5/weather\?lat=$LAT\&lon=$LON\&appid=$API_KEY\&units=imperial" + url="https://api.openweathermap.org/data/2.5/weather?lat=$LAT&lon=$LON&appid=$API_KEY&units=$UNITS" res=$(curl --silent -fL "$url") echo "$res" } -while getopts "c:s:z:" opt; do +while getopts "c:s:z:u:" opt; do case "$opt" in 'c' ) COORDS="$OPTARG" @@ -41,6 +41,8 @@ while getopts "c:s:z:" opt; do 'z' ) ZIPCODE="$OPTARG" ;; + 'u' ) + UNITS="$OPTARG" '?' ) echo "ERROR: UNRECOGNZIED ARGUMENT" exit 1