fixed weather search
This commit is contained in:
parent
49e8df2239
commit
b738b64a8c
@ -25,12 +25,12 @@ get_weather() {
|
|||||||
LAT=$(echo "$COORDS" | awk -F , '{print $1}')
|
LAT=$(echo "$COORDS" | awk -F , '{print $1}')
|
||||||
LON=$(echo "$COORDS" | awk -F , '{print $2}')
|
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")
|
res=$(curl --silent -fL "$url")
|
||||||
echo "$res"
|
echo "$res"
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts "c:s:z:" opt; do
|
while getopts "c:s:z:u:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
'c' )
|
'c' )
|
||||||
COORDS="$OPTARG"
|
COORDS="$OPTARG"
|
||||||
@ -41,6 +41,8 @@ while getopts "c:s:z:" opt; do
|
|||||||
'z' )
|
'z' )
|
||||||
ZIPCODE="$OPTARG"
|
ZIPCODE="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
'u' )
|
||||||
|
UNITS="$OPTARG"
|
||||||
'?' )
|
'?' )
|
||||||
echo "ERROR: UNRECOGNZIED ARGUMENT"
|
echo "ERROR: UNRECOGNZIED ARGUMENT"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user