9 lines
335 B
Bash
Executable File
9 lines
335 B
Bash
Executable File
#!/bin/bash
|
|
weather=$(curl -s "wttr.in/?format=%c%t" 2>/dev/null)
|
|
if [ -z "$weather" ] || echo "$weather" | grep -q "Unknown"; then
|
|
echo '{"text": "N/A", "tooltip": "Weather unavailable"}'
|
|
exit 0
|
|
fi
|
|
tooltip=$(curl -s "wttr.in/?format=%l:+%C+%t+%w+%h" 2>/dev/null)
|
|
echo "{\"text\": \"${weather}\", \"tooltip\": \"${tooltip}\"}"
|