From 969e72f605a370bfadef22cd23f2d97aa520603b Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Mon, 25 Apr 2022 04:39:41 +0300 Subject: [PATCH] weather: if no data, exit --- common/weather | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/weather b/common/weather index a0ccbf2..22770aa 100755 --- a/common/weather +++ b/common/weather @@ -20,4 +20,9 @@ DATA=($(curl -s "${WHOLE}" \ 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"