I need help counting the number of attempts to guess the right number. I can't seem to get the total number. I get an output like this 0+1+1+1+1+1 and so on.

secretNumber=$(( ((`date +%S`) % 59) +1 ))
guess=-1
count=0
while [ "$guess" != "$secretNumber" ]; do
        count=$count+1
        echo -n "Enter a guess between 0 and 59: "
        read guess
        if [ "$guess" = "" ]; then
                echo "Enter a number."
        elif [ "$guess" = "$secretNumber" ]; then
                echo -e "$guess is the correct answer!"
                echo "It took you this may tries: " $count
        elif [ "$secretNumber" -gt "$guess" ]; then
                echo "Your guess is too low."
        else
                echo "Your guess is too high."
        fi
done

It should be

count=$(($count+1))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.