weather: if no data, exit

This commit is contained in:
Siina Mashek 2022-04-25 04:39:41 +03:00
parent 6194f40e0d
commit 969e72f605

View File

@ -20,4 +20,9 @@ DATA=($(curl -s "${WHOLE}" \
DESC="${DATA[@]:2}" DESC="${DATA[@]:2}"
# If no data, exit
if [[ $DATA == *"null"* ]]; then
exit
fi
printf "${LOCATION}: ${DESC:1:-1}, ${DATA[0]}°C (feels like ${DATA[1]}°C)\n" printf "${LOCATION}: ${DESC:1:-1}, ${DATA[0]}°C (feels like ${DATA[1]}°C)\n"