[bash] Command line calculator
Add the following function to the ~/.bashrc or ~/.bash_aliases, source the former and you’ll get a better command line calculator:
? () { echo "$*" | bc -l; }
You can use it the following way:
$ ? 7*3-5.5
and, no doubt that you’ll get 15.5 as the answer.
N.B. If you use parentheses, you must enclose the whole expression by double quotes.
UPDATE: An alternative way of using bc
$ bc -l <<< "7*3 - 5.5"

[...] Posted in awk, cli, linux, osx, unix by kousik on November 3, 2009 This is an update on our bash command line calculator posted a few days ago — except for the fact that this time we’ll use awk to do the [...]
[...] is an update on our bash command line calculator posted a few days ago — except for the fact that this time we’ll use awk to do the calculation [...]