From 8c156a9981201279454a22fdbac8b556ad498b08 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Mon, 15 May 2023 17:06:50 +0200 Subject: [PATCH] Zaktualizuj 'tabledata/ex1.sh' --- tabledata/ex1.sh | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tabledata/ex1.sh b/tabledata/ex1.sh index fb96f9f..04162d0 100755 --- a/tabledata/ex1.sh +++ b/tabledata/ex1.sh @@ -4,15 +4,6 @@ #numOfPeople=`cat $1 | grep $2 | wc -l` #echo "Num. of people from $2 is $numOfPeople" -echo "Podaj nazwę pliku z bazą danych" -read inPlikWej -echo "Podaj minimalny wiek" -read inWiek - -w=0 - -declare -A kraje - # iterating line-by-line while read line do @@ -24,16 +15,11 @@ country=`echo $line | cut -d " " -f 3` if [ $name != "#" ] then -w=$((w + 1)) - -if [ $age -ge $inWiek ] +if [ $country = "$2" -a $age -ge $3 ] then - kraje["$country"]=$((kraje["$country"] + 1)) echo "Person $name (from $country) is $age years old" fi fi -done < $inPlikWej - -for key in ${!kraje[@]}; do echo "From $key there is ${kraje["$key"]} persons"; done +done < $1