aboutsummaryrefslogtreecommitdiff
path: root/scripts/weather
blob: 3fcab9254e3336290a46151b1b280330a97eddaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/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")"
}

while :; do
	echo $(get_current_temp) > /tmp/weather_stat
	sleep 3600
done