Expression recursion level question

Hi. I am receiving this error message for the highlighted line (let "total=$total+$sales").
line 11: let: total+sales:expression recursion level exceeded (error token is "total+sales")

counter=0
sales=0
total=0
echo "enter sales price"
read sales
total=total+sales
while test $sales  ;  do
let "counter=$counter+1"
let "total=$total+$sales"
done
echo $sales
echo $counter
echo $total

Is anyone familiar with this error message?
Thank you

The message is somewhat misleading but is caused by your while loop.

while test $sales  ;  do
   let "counter=$counter+1"
   let "total=$total+$sales"
done

This loop will run forever until you kill the process. You need to modify your test of $sales to provide a loop termination condition.

You have a couple of logic errors, and some syntax changes needed.

counter=0
sales=0
total=0

echo "enter sales price"
read sales

while [ $sales -ne 0 ]  ;  do
   echo "enter sales price \c"  # echo -n with no \c in bash
   read sales
   
   counter=$((counter+1))
   let total=$((total+sales))
done
echo $sales
echo $counter
echo $total

use the $(( )) construct for integer arithmetic operations

Note: shell will not do floating point operations, i.e., 1.3 +
2.75, natively. You have to invoke a utility like bc.

Thank you fp and Jim McNamara.

Jim, why are there two instances of::confused:

echo "enter sales price"
read sales
. . .
while. . .
echo "enter sales price \c"
read sales

Again thanks for the jump start.
Ccccc

P.S. I'm getting zeroes for "sales" & "counter" and blank for total.

Haven't we been here before?

http://www.unix.com/shell-programming-scripting/131681-running-total-running-wild.html

Methyl, thank you for pointing this out. I am closing this thread as a duplicate. Please continue the discussion on the other thread, i.e. Running Total Running Wild