my-scripts/update-weather.sh

17 lines
295 B
Bash
Executable File

#!/usr/bin/env sh
[ "$1" = "-i" ] && sleep 10
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
date >> ~/.cache/wttr_update
else
echo "❗" > ~/.cache/wttr
fi