A bash calculator
From SHellium Wiki
A bash calculator
This is simple bash trick for quick and dirty arithmetic calculation. Here, we make use of bc which is by definition is an arbitrary precision calculator language and quite a flexible tool. What we are about make is a shell calculator which takes standard arithmetic expressions as input and provides us with the required calculated output.
Now, in your ~/.bashrc file punch in following function. In the example below, the switch -l makes bc use the standard math library. The parameter "${1}" is echoed and piped to bc.
function calcu { echo "${1}"|bc -l; }
Reload your .bashrc file
source ./.bashrc
Example calculation
calcu 14+5/2*6 29.00000000000000000000