Re: simple calculator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > Does anyone know of a calculator which is simple which I can
> > use at the command line?

In addition to Sébastien's suggestion of using bc (my preferred console
tool), there's a debian tool called "calc" which allows quick and dirty
command line parsing so you can do

bash# calc 4 + 5

Beware the gotcha that the shell will expand an asterisk (used for
multiplication as in most languages), so you've got to quote anything
you're multiplying like

bash# calc "6*9"

You can find them on Micheal Stutz's page at

http://dsl.org/comp/tinyutils/

It's a massive 7k gzipped tar file...don't break your 14.4 modem now
(grins)  While "calc" is the program of interest, there are some other
tools in the package may be helpful if you want them.  They're all
described on that page, or if you want examples, you can read them in an
online copy of "The Linux Cookbook" (a great read by the way, with some
good tips) available for free at

http://www.dsl.org/cookbook/cookbook_35.html

(the direct link to the page on using "calc" and "bc").  With "bc", be
sure to set your "scale" variable for the number of decimal places
you're interested in.  If you're just doing financial, you may only need
2-3 decimal places.

On top of those two, there's also "sc", the console spreadsheet (I've
heard about "oleo" as well, but haven't gotten to try it) which gives
you much more power and flexibility than the simplicity that "bc" and
"calc" offer.  It supports calculated fields, and the like so it's
pretty powerful.  It's got vi-like keybindings, so if you're not one of
us nutcases that are on this side of the holy war, you might want to
explore other options (oleo might have less in common with vi...again,
haven't tried it).  There's also an "sc" variant called "ss" that
behaves more like lotus-123 did.  I can't find a Linux port of that,
though there's one in the FreeBSD Ports archive--it should be pretty
straightforward to build it on the Linux side of things.

You can find more about "oleo" on the GNU website at
http://www.gnu.org/software/oleo/oleo.html

Hope this helps,

-tim








_______________________________________________

Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list

[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]