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`

```
Arithmetic operations more complex than integer additions can be performed with [`dc`](http://en.wikipedia.org/wiki/Dc_%28computer_program%29) or [`bc`](http://en.wikipedia.org/wiki/Bc_programming_language) command line calculators.

`dc` is reverse polish notation whereas `bc` is more familiar.