Don't show if Unknown location

This commit is contained in:
speediegq 2022-10-25 21:22:05 +02:00
parent f5a835df30
commit 12ef8122c0

View file

@ -29,8 +29,10 @@ CLICK() {
FORECAST="$(cat /tmp/wstatus)"
else
echo "FATAL: No weather status available!"
exit 1
exit
fi
grep -q "Unknown location" /tmp/wstatus && exit
# no spacing if there's no icon
if [ "$ICON" != "" ]; then
@ -60,7 +62,9 @@ PRINT() {
if [ -e "${BINDIR}curl" ]; then
if [ -e "/tmp/itest" ]; then
if [ -e "/tmp/wstatus" ]; then
grep -q "<html>" /tmp/wstatus || echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
grep -q "Unknown location" /tmp/wstatus && exit
grep -q "<html>" /tmp/wstatus || exit
echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"
else
echo "$(curl -s wttr.in/?format="%C"), $(curl -s wttr.in/?format=3 | sed 's/.* //; s/.*\(.....\)/\1/')" > /tmp/wstatus
echo "$SEPARATOR $ITEM5_ICON $(cat /tmp/wstatus)"