score=0 of=0 clear; while [ 1 = 1 ]; do ans= num1=$((RANDOM%13+0)) num2=$((RANDOM%13+0)) sign=$((RANDOM%4+0)) printf "/exit to quit\n" read -p $num1'x'$num2= -t 5 ans let answer=$num1*$num2 cor=$(expr $ans = $answer) if [ "$cor" = "1" ]; then printf "\nCorrect.\n" && score=$(expr $score + 1) && of=$(expr $of + 1 ) else printf "\nWrong, the correct answer is "$answer"\n" && of=$(expr $of + 1); # elif [ $cor = '/exit' ]; # then clear # echo "You got $score right." # read -p 'Hit enter to exit' # exit 0; # fi; fi; printf 'So far you have answered '$score' out of '$of' right.' seconds=$(date '+%S') if [ $seconds -gt "57" ]; then let new=$seconds-56; else let new=$seconds+4; fi; while [ $seconds -lt $new ];do seconds="" seconds=$(date '+%S') done; clear; done;