Compare commits

..

No commits in common. "c477b995716e45adbadea34e653de4327bba27c1" and "d18ee6abe3d191f2c830ccbe56ca6d2cb74729cb" have entirely different histories.

2 changed files with 6 additions and 28 deletions

View File

@ -1,18 +0,0 @@
echo "Guess game. What is the number I'm thinking about?"
num=$(($(($RANDOM % 20))+1))
ex=1
while [ 1 -eq $ex ]
do
read usr
if [ $num == $usr ]
then
echo "Great it is $num"
ex=0
else
echo "No, it is not that number"
fi
done

View File

@ -8,11 +8,12 @@ echo "Podaj plik z danymi"
read inPlik
echo "Podaj wiek"
read inWiek
echo "Podaj kraj"
read inKraj
ile=0
wszyscy=0
declare -A kraje
# iterating line-by-line
while read line
do
@ -26,9 +27,9 @@ then
wszyscy=$((wszyscy+1))
if [ $age -ge $inWiek ]
if [ $country = "$inKraj" -a $age -ge $inWiek ]
then
kraje["$country"]=$((kraje["$country"]+1))
ile=$((ile+1))
echo "Person $name (from $country) is $age years old"
fi
@ -37,9 +38,4 @@ fi
done < $inPlik
#echo "There is $ile people from $inKraj (from all $wszyscy people)"
#echo "There is `echo "scale=2; $ile/$wszyscy*100.0" | bc -l`% people from $inKraj"
#echo "Num of people from Poland is ${kraje["Poland"]}"
#echo "Num of people from Germany is ${kraje["Germany"]}"
for key in ${!kraje[@]}; do echo "People from $key is `echo "scale=2; ${kraje["$key"]}/$wszyscy*100.0" | bc -l`%"; done
echo "There is `echo "scale=2; $ile/$wszyscy*100.0" | bc -l`% people from $inKraj"