To use the linux command bc for calculation in shell programs, do the following:
Here- Add the line scale=2 to the file ~/.bcrc.
- Then use var1=`echo "($var2+$var3)/$var4" | bc` to set var1.
- The scale parameter tells bc to use 2 decimal digits.
No comments:
Post a Comment