29 lines
618 B
Bash
29 lines
618 B
Bash
|
#!/bin/bash
|
||
|
# number of arguments must be 3
|
||
|
...
|
||
|
# $2 positive integer and <= 100 ?
|
||
|
...
|
||
|
# $3 file readable ?
|
||
|
...
|
||
|
shopt -s nocasematch
|
||
|
nday=1
|
||
|
totalcases=0
|
||
|
#=======================
|
||
|
echo "# nday cases totalcases"
|
||
|
# format : dateRep day month year cases deaths countriesAndTerritories geoId countryCode pop
|
||
|
# read one line and split it until End of File
|
||
|
while ...
|
||
|
do
|
||
|
# continue if country doesn't match $1
|
||
|
...
|
||
|
# Filtering the noise
|
||
|
...
|
||
|
# break if nday > $2
|
||
|
...
|
||
|
((totalcases=totalcases+cases))
|
||
|
echo $nday $cases $totalcases
|
||
|
# increasing nday
|
||
|
...
|
||
|
done ... # read from data file
|
||
|
exit 0
|