Yet another simple command line Calculator

Aug 08, '06 07:30:00AM

Contributed by: sebo

Add the following to your .bashrc for a quick calculator:

calc () { 
    echo "$@" | bc -l
}
Now at the prompt you may try something like...
$ calc "2 * 3F"
...and instantly receive the result -- no need for some GUI tool.

[robg adds: There are two other command line calculator hints here. This one worked for me, at least with the commands added to my .bash_profile file.]

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060804023558426