all configurations

This commit is contained in:
wt committed 2024-05-09 12:27:34 +07:00
1 parent 11bb8fabfa
commit efb61ce158
9 files changed
+65 -4

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
for i in {1..5}
do
text=$(curl -s "https://wttr.in/$1?format=1")
if [[ $? == 0 ]]
then
text=$(echo "$text" | sed -E "s/\s+/ /g")
tooltip=$(curl -s "https://wttr.in/$1?format=4")
if [[ $? == 0 ]]
then
tooltip=$(echo "$tooltip" | sed -E "s/\s+/ /g")
echo "{\"text\":\"$text\", \"tooltip\":\"$tooltip\"}"
exit
fi
fi
sleep 2
done
echo "{\"text\":\"error\", \"tooltip\":\"error\"}"