Shift X2 status from legacy to archived
[khatus.git] / khatus_update_weather
... / ...
CommitLineData
1#! /bin/bash
2
3set -e
4
5FILE_METAR_DECODED="$HOME/var/run/metar-KJFK-decoded"
6FILE_TEMP_FAHRENHEIT="${FILE_METAR_DECODED}-temp-fahrenheit"
7
8(metar -d KJFK 2>&1) > $FILE_METAR_DECODED # TODO: Better error handling
9
10awk '
11 /METAR pattern not found in NOAA data/ {
12 failures++
13 }
14
15 /^Temperature/ {
16 celsius = $3;
17 fahrenheit = (celsius * (9 / 5)) + 32;
18 }
19
20 END {
21 if (failures > 0) {
22 print "--";
23 } else {
24 print fahrenheit;
25 }
26 }' \
27 $FILE_METAR_DECODED \
28> $FILE_TEMP_FAHRENHEIT
This page took 0.025588 seconds and 5 git commands to generate.