Monday, February 25, 2008

How to Create a Terminal Calculator
      Put the following in your .bashrc file

            function calc
            {
             echo "${1}"|bc -l;
            }

      Or, run it at the shell prompt. Now
      "calc" from the shell will work as follows:

            $ calc 3+45
               48

      All functions  with a "(" or ")" must be enclosed
      in quotes.  For instance, to get the sin of .4

            $ calc "s(.4)"
              .38941834230865049166

No comments: