im doing an assignment where i have to make a script, and it doesn't seem to be adding to the counter to display the clues when the counter reaches a certain number Here is the code below
#!/bin/bash
#This is a game that is played by the user having to guess a number that the computer thinks of.
counter=0
# functions
function clueOne() {
echo “The number is over 50”
return
}
function clueTwo() {
echo “The number is smaller than 100 and is devided by 7, 10 times”
return
}
function selectANumber() {
dialog --backtitle "Number Game" --title "Number Game" --infobox "Thinking of a number..."
10 50 ; clear
}
selectANumber
# game starts here
while [ $counter -le 10 ]; do
read -p ”Guess my number human!”
if [ $counter -eq 5 ];
then
clueOne
counter=$((counter+1))
elif [ $counter -eq 9 ];
then
clueTwo
counter=$((counter+1))
elif [ $REPLY = 70 ];
echo “Yes that is my number!”;
exit 1
echo “Wrong number”
counter=$((counter+1))
fi
done
echo “Sorry you ran out of attempts”