Merge branch 'master' of https://git.wmi.amu.edu.pl/ahypki/unixowe-systemy-operacyjne
This commit is contained in:
commit
f4690816a6
@ -6,11 +6,13 @@
|
|||||||
|
|
||||||
echo "Podaj nazwę pliku z bazą danych"
|
echo "Podaj nazwę pliku z bazą danych"
|
||||||
read inPlikWej
|
read inPlikWej
|
||||||
echo "Podaj kraj, który wyszukać"
|
|
||||||
read inKraj
|
|
||||||
echo "Podaj minimalny wiek"
|
echo "Podaj minimalny wiek"
|
||||||
read inWiek
|
read inWiek
|
||||||
|
|
||||||
|
w=0
|
||||||
|
|
||||||
|
declare -A kraje
|
||||||
|
|
||||||
# iterating line-by-line
|
# iterating line-by-line
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
@ -22,11 +24,16 @@ country=`echo $line | cut -d " " -f 3`
|
|||||||
if [ $name != "#" ]
|
if [ $name != "#" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
if [ $country = "$inKraj" -a $age -ge $inWiek ]
|
w=$((w + 1))
|
||||||
|
|
||||||
|
if [ $age -ge $inWiek ]
|
||||||
then
|
then
|
||||||
|
kraje["$country"]=$((kraje["$country"] + 1))
|
||||||
echo "Person $name (from $country) is $age years old"
|
echo "Person $name (from $country) is $age years old"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < $inPlikWej
|
done < $inPlikWej
|
||||||
|
|
||||||
|
for key in ${!kraje[@]}; do echo "From $key there is ${kraje["$key"]} persons"; done
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
# name age country
|
# name age country
|
||||||
Peter 45 Poland
|
Peter 45 Poland
|
||||||
Christof 34 Germany
|
Christof 34 Germany
|
||||||
|
Jurgen 24 Germany
|
||||||
Paul 35 Poland
|
Paul 35 Poland
|
||||||
Jacek 55 Poland
|
Jacek 55 Poland
|
||||||
|
Jurek 67 Poland
|
||||||
Maria 23 France
|
Maria 23 France
|
||||||
Jerry 25 Germany
|
Jerry 25 Germany
|
||||||
Paul 60 France
|
Paul 60 France
|
||||||
|
Frederic 9 France
|
||||||
|
Agostino 20 Italy
|
||||||
|
Toni 15 Italy
|
||||||
|
Loading…
Reference in New Issue
Block a user