Introduction
Introduction Statistics Contact Development Disclaimer Help
Add IATA support to metar - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 61806e102bcdde27631d0ea7b9ca351bbf789e2c
parent 58d3d554ce0e9955b0444a80ed162ecf5a6e2c4d
Author: Annna Robert-Houdin <[email protected]>
Date: Wed, 9 Oct 2024 18:01:07 +0200
Add IATA support to metar
Diffstat:
M metar | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/metar b/metar
@@ -1,8 +1,17 @@
#!/bin/sh
if ! id=$(printf '%s\n' "$1" | grep '^[A-Za-z]\{4\}$'); then
- printf '%s\n' "invalid ICAO 7910 airport code."
- exit 1
+ if ! id=$(printf '%s\n' "$1" | grep '^[A-Za-z]\{3\}$'); then
+ printf '%s\n' "invalid ICAO 7910 airport code."
+ exit 1
+ fi
+ id="$(grep ",${1}," /home/annna/bin/modules/airport-codes/data/airport-cod…
+ | head -n 1 \
+ | cut -d',' -f 1)"
+ if [ -z "${id}" ]; then
+ printf '%s\n' "invalid ICAO 7910 airport code."
+ exit 1
+ fi
fi
fmt=raw
@@ -15,3 +24,4 @@ if [ -z "$metar" ]; then
fi
printf '%s\n' "$metar"
+
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.