Zaktualizuj 'tabledata/ex1.sh'
This commit is contained in:
parent
2129be264a
commit
8c156a9981
@ -4,15 +4,6 @@
|
|||||||
#numOfPeople=`cat $1 | grep $2 | wc -l`
|
#numOfPeople=`cat $1 | grep $2 | wc -l`
|
||||||
#echo "Num. of people from $2 is $numOfPeople"
|
#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
|
# iterating line-by-line
|
||||||
while read line
|
while read line
|
||||||
do
|
do
|
||||||
@ -24,16 +15,11 @@ country=`echo $line | cut -d " " -f 3`
|
|||||||
if [ $name != "#" ]
|
if [ $name != "#" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
w=$((w + 1))
|
if [ $country = "$2" -a $age -ge $3 ]
|
||||||
|
|
||||||
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 < $1
|
||||||
|
|
||||||
for key in ${!kraje[@]}; do echo "From $key there is ${kraje["$key"]} persons"; done
|
|
||||||
|
Loading…
Reference in New Issue
Block a user