You are running into 2 problems:
1 - The * is special when using
`expr $num1 * $shirt`. This causes the
expr: syntax error
You need to escape it:
`expr $num1 \* $shirt`
2 - This is the biggest problem: Bash doesn't handle fractions that well. This may cause the following error:
Code:
num=3
shirt=13.5
total=`expr $num1 \* $shirt`
expr: non-integer argument
Using bc can solve all the above:
Code:
num=3
shirt=13.5
total=$( echo "$shirt * $amount" | bc )
BTW: Don't do this:
Code:
shirt=\$15.00
black=\$13.50
The dollar sign can be added to the amount/price individually. If you don't you need to remove the $ from the string before you do the arithmetic.