Great bash calculator

November 3, 2009

I spend a lot of time on the command line, shop and one thing I run up against every once in a while is doing math. I normally jump through the bc hoops, malady 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.

Categories: Geek
Tags: , ,

Leave A Comment

Your email will not be published.