Just add following line in your .bashrc file (~/.bashrc).
function calc
{
echo "${1}" | bc -l;
}
Then update the shell environment by:
$ source ~/.bashrc
"calc" from the shell will work as follows:
$ calc 2+3
5
$ calc 1+2*3
7
$ calc 1.1*2
2.2
$ calc "(1+2)*3"
9
$ calc "(1+2)^3"
27
$ calc "s(.5)"
.47942553860420300027
No comments:
Post a Comment