From the article 'Create an Awesome Command Line Calculator'...
'To create the calculator, you can just enter this function on the command
line to test out how it works, or add it into your ~/.bashrc file to make
sure that it's always available after restarting the terminal.
calc(){ awk "BEGIN{ print $* }" ;}
To use it, you can simply type calc followed by the calculation you want to
solve, making sure to use quotes around the calculation if there are spaces
or special characters the shell can't handle. For instance, if you entered
calc 3*99/7+18 at the prompt, you'd get 60.4286 as the answer. For more
complex calculations, you can use parenthesis, but make sure to put quotes
around it, like this:
calc "((3+(2^3)) * 34^2 / 9)-75.89"'
article here:
<
http://lifehacker.com/5396183/create-an-awesome-command-line-calculator>
A windows equivalent via s doskey macro: doskey calc=gawk "BEGIN{print $*}"
calc 5^3
125
notes...
with doskey '$*' is meta variable that passes all doskey arguments (only
doskey, bat/cmd scripts use '%*' instead).
--
Mike Sanders
www.peanut-software.com