mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-15 17:45:12 -05:00
19 lines
No EOL
493 B
Bash
Executable file
19 lines
No EOL
493 B
Bash
Executable file
#!/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\"}" |