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.

jmhobbs@asuka:~$ calc 9*100+14/10
901.4
jmhobbs@asuka:~$

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