add scripts

This commit is contained in:
Simon Belmont 2025-03-24 12:47:13 -04:00
parent 8e5898aa57
commit 428458e50a
36 changed files with 934 additions and 0 deletions

19
.bin/sh/weather.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# weather.sh
for i in {1..5}
do
text=$(curl -s "https://v2.wttr.in/$1?format=1&m")
if [[ $? == 0 ]]
then
text=$(echo "$text" | sed -E "s/\s+/ /g")
tooltip=$(echo -ne "Santo Domingo, Dominican Republic:";curl -s "https://wttr.in/$1?format=2&m")
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\"}"