I'm learning Shell scripting, I'm trying to write a small script that adds and multi number as shown below But amt value not display
value=212
amt=`expr "( $value * 2 + ( $value * 2 * .075 ) ) " | bc`
echo $amt
Your code works fine, but I suggest some improvements:
$(...) instead of backticks.expr with echo.Example:
value=212
amt=$(echo "( $value * 2 + ( $value * 2 * .075 ) ) " | bc)
echo $amt
Output:
455.800
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With