linux - Add and Multiply numbers using shell script -
i'm learning shell scripting, i'm trying write small script adds , multi number shown below amt value not display
value=212 amt=`expr "( $value * 2 + ( $value * 2 * .075 ) ) " | bc` echo $amt
your given code works fine, intend suggest improvements:
- use
$(...)instead of backticks. - replace
exprecho.
example:
value=212 amt=$(echo "( $value * 2 + ( $value * 2 * .075 ) ) " | bc) echo $amt output:
455.800
Comments
Post a Comment