File: cty

package info (click to toggle)
hamradio-files 20210608
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 964 kB
  • sloc: sh: 59; makefile: 9
file content (35 lines) | stat: -rwxr-xr-x 834 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

set -eux

: %%%%% Retrieving VERSION entity from history.txt %%%%%

VERSION=$(sed -ne 's/.*Version entity is \(.*\),.*/\1/p' bigcty/history.txt)
[ "$VERSION" ]

: %%%%% Checking cty.dat %%%%%

# Monaco:                   14:  27:  EU:   43.73:    -7.40:    -1.0:  3A:
#     3A,=3A/4Z5KJ/LH;

cty_dat_lookup ()
{
  pfx="$1"
  sed -ne "1,/\\b$pfx\\b/p" /usr/share/hamradio-files/cty.dat | egrep -o '^[A-Z][A-Za-z .]+' | tail -1
}

[ "$(cty_dat_lookup DF)" = "Fed. Rep. of Germany" ]
[ "$(cty_dat_lookup VERSION)" = "$VERSION" ]

: %%%%% Checking cty.csv %%%%%

# 3A,Monaco,260,EU,14,27,43.73,-7.40,-1.0,3A =3A/4Z5KJ/LH;

cty_csv_lookup ()
{
  pfx="$1"
  egrep "\\b$pfx\\b" /usr/share/hamradio-files/cty.csv | cut -d ',' -f 2
}

[ "$(cty_dat_lookup DF)" = "Fed. Rep. of Germany" ]
[ "$(cty_dat_lookup VERSION)" = "$VERSION" ]