update to .dot-files-laptop
This commit is contained in:
parent
ba1a306817
commit
24b6464d0b
46 changed files with 3332 additions and 0 deletions
19
.dot-files-laptop/.bin/sh/weather.sh
Executable file
19
.dot-files-laptop/.bin/sh/weather.sh
Executable 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\"}"
|
Loading…
Add table
Add a link
Reference in a new issue