aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/weather17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/weather b/scripts/weather
index 3fcab925..cc0ac150 100755
--- a/scripts/weather
+++ b/scripts/weather
@@ -1,12 +1,21 @@
#!/bin/bash
get_current_temp() {
- temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $9 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g") # > /tmp/weather_temperature)
- stat=$(curl wttr.in | awk 'NR==3 {print $1}')
- echo $temp "("$stat")"
+ if [ $stat == "Smoke" ]; then
+ temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $4 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g")
+ elif [ $stat == "Haze" ]; then
+ temp=$(curl wttr.in | grep °C | awk 'NR==1 {print $9 "°C"}' | sed -r "s/\x1B\[(([0-9]+)(;[0-9]+)*)?[m,K,H,f,J]//g")
+ fi
+
+ echo $temp
+}
+
+get_current_weather() {
+ stat=$(curl wttr.in | awk 'NR==3 {print $1}')
+ echo $(get_current_temp) "("$stat")"
}
while :; do
- echo $(get_current_temp) > /tmp/weather_stat
+ echo $(get_current_weather) > /tmp/weather_stat
sleep 3600
done