jmhobbs

Great bash calculator

I spend a lot of time on the command line, and one thing I run up against every once in a while is doing math. I normally jump through the bc hoops, but today this bit came through my feed reader.

calc(){ awk "BEGIN{ print $* }" ;}

Just drop it into your .bashrc, .alias, or whatever else you use.

[email protected]:~$ calc 9*100+14/10
901.4
[email protected]:~$

Great solution using existing tools, props to TinyHacker.com for this one.