dotfiles-old/.local/scripts/update-weather.sh

17 lines
357 B
Bash
Raw Normal View History

2022-03-10 03:42:22 +00:00
#!/usr/bin/env sh
[ "$1" = "-i" ] && sleep 10
#UPDATE="$(curl --connect-timeout 30 "wttr.in/Huntsville+Alabama?format=1")" # > ~/.cache/wttr
UPDATE="$(curl --connect-timeout 30 "wttr.in/?format=1")" # > ~/.cache/wttr
echo $UPDATE | wc -m
if [ $(echo $UPDATE | wc -m) -le 30 ]; then
echo "$UPDATE" > ~/.cache/wttr
else
echo "❗" > ~/.cache/wttr
fi