bash mathematical calculators.

2011-01-25 3 min read bash Fedora Learning Linux

To start with , the most simple and easy to use should be “bc”. but just for some guys who want to be more experimental, here are few more bash calulator programs. These are completely command line and thus you can completely integrate them in your shell script or use them in shell script to do some really crazy maths calculations.

  <td>
    <div class="text codecolorer">
      sudo yum install calc clac
    </div>
  </td>
</tr>
1

Lets start with installing these. Before we start, don’t blame and flame me if your favourite is not there in the list. If it is not, better is you drop me  a comment or email, and I will see, if I can include it in the list above, but remember this is only for console based calculators.

First clac:

Name        : clac                         Relocations: (not relocatable)
Version     : 005                               Vendor: Fedora Project
Release     : 1.fc14                        Build Date: Mon 23 Aug 2010 01:45:04 PM IST
Install Date: Tue 14 Dec 2010 03:10:50 PM IST      Build Host: x86-19.phx2.fedoraproject.org
Group       : Applications/Engineering      Source RPM: clac-005-1.fc14.src.rpm
Size        : 13003                            License: GPLv3+
Signature   : RSA/SHA256, Mon 23 Aug 2010 09:52:32 PM IST, Key ID 421caddb97a1071f
Packager    : Fedora Project
URL         : http://sourceforge.net/projects/clac/
Summary     : Command Line Advanced Calculator
Description :
clac (Command Line Advanced Calculator) evaluates mathematical expressions
from the argument list or from stdin and writes the answer(s) to stdout.

clac is written in python, so anytime you want to get into python help, you can type

  <td>
    <div class="text codecolorer">
      help()
    </div>
  </td>
</tr>
1

other than that for most of the math calculations, you can simply type the expression to get the result. And remember you can always do :

  <td>
    <div class="text codecolorer">
      echo "8+3"|clac
    </div>
  </td>
</tr>
1

and then calc:

Name        : calc                         Relocations: (not relocatable)
Version     : 2.12.2.1                          Vendor: Fedora Project
Release     : 14.fc12                       Build Date: Sat 25 Jul 2009 06:46:45 AM IST
Install Date: Tue 14 Dec 2010 03:10:52 PM IST      Build Host: x86-3.fedora.phx.redhat.com
Group       : Applications/Engineering      Source RPM: calc-2.12.2.1-14.fc12.src.rpm
Size        : 2601450                          License: GPLv2
Signature   : RSA/SHA256, Thu 29 Jul 2010 01:27:10 AM IST, Key ID 421caddb97a1071f
Packager    : Fedora Project
URL         : http://isthe.com/chongo/tech/comp/calc/
Summary     : Arbitrary precision arithmetic system and calculator
Description :
Calc is an arbitrary precision C-like arithmetic system that is a
calculator, an algorithm-prototyper, and a mathematical research tool. Calc
comes with a rich set of built-in mathematical and programmatic functions.

Note: this copy of Calc is linked against the GNU Readline library and has
been converted to the ordinary GPL as per section 3 of the LGPL. See the
included calc-converted-to-gpl.txt document for details.

So far, calc is the only application where I see a prompt, “;”. other than that all the other functionalities remain the same. So, go ahead and enjoy spending some time in exploring these applications.

comments powered by Disqus