Yes, still practicing, and making a script for the children.
So far thanks for your information. Together with the above script I have a second script. (see below)
What goes wrong is, when a question is asked wrong, it will repeat this question. So far so good.
But when the second time the answer to the question is given correct, it still repeats!
I think there is something wrong with the "else.......read $getallinks x $getalrechts" part... But what is?
It has to repeat the question with the wrong answer till the correct answer is given.. !
Still learning much with bash scripting.. Thanks to you!
Quote:
#!/bin/bash
while true
do
getallinks=$((RANDOM/(32767/10)+1))
getalrechts=$((RANDOM/(32767/10)+1))
echo "Hoeveel is $getallinks x $getalrechts ?"
read -p "Antwoord: " antwoordleerling
antwoordjuiste=$((getallinks*getalrechts))
if test $antwoordleerling == $antwoordjuiste
then
echo "Goed zo! $getallinks x $getalrechts is inderdaad $antwoordjuiste."
else
while (( $antwoordleerling != $antwoordjuiste ))
do
echo "Fout! Probeer het nogmaals $getallinks x $getalrechts ="
read $getallinks x $getalrechts
done
fi
done