-
Notifications
You must be signed in to change notification settings - Fork 0
/
corona
executable file
·69 lines (54 loc) · 1.99 KB
/
corona
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
## Downloads Typical Data Pool to Temp Locations
download(){
# if last access date 1 day old or more, then curl new data
#[ "$(stat -c %y /tmp/coronach | cut -d ' ' -f1 )" != "$(date '+%Y-%m-%d')" ] &&
# if last access date 50 min old, curl new data.
[[ "$(date +%s) - 3000" -gt "$(stat -c %Y /tmp/coronach)" ]] &&
#download results of whole table to /tmp/coronach
curl -s https://corona-stats.online/ch 2> /dev/null | sed 's/\x1b\[[0-9;]*m//g' | sed '9,$d' > /tmp/coronach
[[ "$(date +%s) - 3000" -gt "$(stat -c %Y /tmp/coronauk)" ]] &&
curl -s https://corona-stats.online/gb 2> /dev/null | sed 's/\x1b\[[0-9;]*m//g' | sed '9,$d' > /tmp/coronauk
}
#Best Function
refresh(){
deathrate
recoverrate
fulldeath
ukdeathscore
uktotal
}
##
deathrate(){
destination='/tmp/ccount'
download
#display confirmed cases, output selection to /tmp/ccount
# Switzerland record for `CH: infected`
grep Switzerland /tmp/coronach | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print $3,"☣"$4'} | cut -d'(' -f2 | tr ')' ':' > $destination
}
recoverrate(){
destination='/tmp/ccount2'
download
# Switzerland record for `CH: recovered`
grep Switzerland /tmp/coronach | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print"☦ "$8'} | cut -d')' -f2 > $destination
}
fulldeath(){
destination='/tmp/ccountf'
download
#grep World /tmp/coronach | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print $3,"☣"$4'} | cut -d'(' -f2 | tr ')' ':' > $destination
# global record for `infected`
grep World /tmp/coronach | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print "☣"$4'} > $destination
}
ukdeathscore(){
destination='/tmp/ccountuk'
download
# uk record for `deathcount`
grep UK /tmp/coronauk | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print $6'} > $destination
}
uktotal(){
destination='/tmp/ccountukt'
download
# uk record for `total deathcount`
grep UK /tmp/coronauk | sed 's/│ /;/g ; s/║ /;/g ; s/ //g' | awk -F';' {'print $3,$4'} | cut -d'(' -f2 | tr ')' ':' > $destination
}
"$@"