Zaktualizuj 'tabledata/ex1.sh'

This commit is contained in:
Arkadiusz Hypki 2023-05-15 17:06:50 +02:00
parent 2129be264a
commit 8c156a9981

View File

@ -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