Raman Sahasi
Raman Sahasi

Reputation: 31901

Calculation using expr in shell

I have used the following code to Calculate simple intrest and its working fine

intrest=$(( $p * $r * $t / 100 ))

However when i try to solve the above using expr it gives me error expr: syntax error

intrest=`expr $p * $r * $t / 100`

Upvotes: 0

Views: 122

Answers (1)

R Sahu
R Sahu

Reputation: 206717

You need to escape the *s.

intrest=`expr $p \* $r \* $t /100`

This has nothing to do with more than two variables.

intrest=`expr $p * $r`

doesn't work either.

Upvotes: 1

Related Questions