Accumulate counter in script

Hi,

I'm new to unix and have a problem? I'm writing a basic script in ksh and it is a basic quiz with 5 questions. I need to be able to accumulate the correct answers at the end and echo out the total correct answers, I cannot work it out? Please see script so far. If anyone can help that will be great?

#!/bin/ksh

usage()
{
if [ $? -eq " " ]
then
printf "\n "usage": $0 (ANSWER REQUIRED A,B,C) \n\n" >&2
else
STATUS="1"
exit 1
fi

}

STATUS=" "
while [ "$answer" = "" ]
do

printf "\nQUESTION 1\n\n"

printf "Who scored the winning goal for Everton in the FA CUP Final of 1995 against Manchester United?: \n\n"
printf "A) Paul Rideout\n"
printf "B) Duncan Ferguson\n"
printf "C) Matt Jackson\n\n"

printf "the answer is: "

read answer

if [ "$answer" = "" ]
then
usage

fi

done

if [[ $answer = [aA] ]]
then
banner "correct"
else
banner "incorrect"

fi

##################################################

STATUS=" "
while [ "$answer2" = "" ]
do

printf "\nQUESTION 2\n\n"

printf "Who has scored the most goals for Everton this season?: \n\n"
printf "A) Tim Cahill\n"
printf "B) Yakubu\n"
printf "C) Joleon Lescott\n\n"

printf "the answer is: "

read answer2

if [ "$answer2" = "" ]
then
usage

fi

done

if [[ $answer2 = [bB] ]]
then
banner "correct"
else
banner "incorrect"

fi

##################################################

STATUS=" "
while [ "$answer3" = "" ]
do

printf "\nQUESTION 3\n\n"

printf "Who is Everton's current goalkeeper this season?: \n\n"
printf "A) John Ruddy\n"
printf "B) Ian Turner\n"
printf "C) Tim Howard\n\n"

printf "the answer is: "

read answer3

if [ "$answer3" = "" ]
then
usage

fi

done

if [[ $answer3 = [cC] ]]
then
banner "correct"
else
banner "incorrect"

fi

##################################################

STATUS=" "
while [ "$answer4" = "" ]
do

printf "\nQUESTION 4\n\n"

printf "What nationality is Yakubu?: \n\n"
printf "A) French\n"
printf "B) Nigerian\n"
printf "C) Spanish\n\n"

printf "the answer is: "

read answer4

if [ "$answer4" = "" ]
then
usage

fi

done

if [[ $answer4 = [bB] ]]
then
banner "correct"
else
banner "incorrect"

fi

##################################################

STATUS=" "
while [ "$answer5" = "" ]
do

printf "\nQUESTION 5\n\n"

printf "Which current Everton midfielder has recently retired from international football for the Republic of Ireland?: \n\n"
printf "A) Lee Carsley\n"
printf "B) Phil Neville\n"
printf "C) Steven Pienaar\n\n"

printf "the answer is: "

read answer5

if [ "$answer5" = "" ]
then
usage

fi

done

if [[ $answer5 = [aA] ]]
then
banner "correct"
else
banner "incorrect"

fi

##################################################

### To get total count I have tried to do both way's but it does not work???

#count=0
#if [ $answer* = "correct" ]
#then
# count=`expr $count + 1`
#
#fi
#
#printf "The amount of questions you have answered correctly is:$count \n\n"

count=0
while [[ [$answer*] = "correct" ]]
do

count=`expr $count + 1`

done

printf "The amount of questions you have answered correctly is:$count \n\n"

Initialize count at the beginning, and increment it whenever you find a right answer.

Like this:

if [[ $answer5 = [aA] ]]
then
banner "correct"
count=`expr $count + 1`
else
banner "incorrect"
fi

Thanks Krishmaths!

A simple solution in the end, Works great, thanks again.