I live in Omaha.
 
Navigation
 
Search
 
Random Image
DSC_0038.JPG
 
Me. Elsewhere.
 
Archives
 
Darcy
 
Recently Read
 
Things I Like
boingboing
 
License
 
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.

Posted November 3rd, 2009 - Permalink
Categories: Geek
Tags: , ,
You can leave a comment, or trackback from your own site.
 
Possibly Related Posts
 
Adjacent Posts
 
Comments
 
Copyright © 2006 - 2010 John Hobbs
get userping