bc – how to do math from the command line

echo ’25+7′ | bc – addition
echo ’25-7′ | bc – subtraction
echo ’25*7′ | bc – multiplication
scale – the scale variable tells how many decimal places to take your answer. The default is 0, unless using -l, in which case the default is 20.
echo ‘scale=5;25/7’ | bc division

3.57142

echo ‘scale=10;sqrt(7)’ | bc square root

2.6457513110

bc -q interactive mode