Question: i have script file.

```
for file in *.TXT
do
    amount=$(less $file | grep BPR | awk -F'CACH' '{c=$1;sub(/[^0-9]*/,"",c);total+=c/100}END{printf "%.2f", total}')
     totalAmount=$(expr $totalAmount+$amount)
done

```

---

now my script look like this

```
for file in *.TXT
do
    amount=$(less $file | grep BPR | awk -F'CACH' '{c=$1;sub(/[^0-9]*/,"",c);total+=c/100}END{printf "%.2f", total}')
    echo "$totalAmount += $amount" | bc -l
done

echo $totalAmount

```

but when i run this it throw error at **$totalAmout+=$amount**. 

i need to store the total amount in variable like totalAmount.

please help me

Answer: 
In bash (> 3.0?) you can do

```
(( totalAmount += amount ))

```

If it is not the problem of a typo, you can try replace your line of `totalAmount=$(expr $totalAmout+$amount)` to `(( totalAmount += amount ))`

If you are dealing with float numbers

```
totalAmount=`echo "$totalAmount + $amount" | bc -l`

```
Space is important, as `expr` is a command that processes its arguments.

```
expr $totalAmount+$amount

```

runs `expr` with a single argument (assuming no word-splitting results from the parameter expansion), while

```
expr $totalAmount + $amount

```

runs `expr` with 3 arguments (again, assuming no other word-splitting). The single argument variety would simply evaluate to the same string; it does not attempt to parse the argument as an addition.

Using `expr` for arithmetic is mostly obsolete, as the POSIX standard includes arithmetic expansion in the form of

```
totalAmount=$(( totalAmount + amount ))

```