REALITYPOD
Realitypod

How to solve equations by using Terminal + create your own Calculator function

Most MAC users always have accessed Terminal Window open and you might have given a hotkey in order to launch Terminal window quickly at anytime you need. So why you open Calculations for solving any equation when you can also solve it here on command line?

So, here you will see a way to create Calculator by using the built-in function. All you need is to assign question mark for running bc command along with arguments that you write after this command.

Create Terminal Calculator function

  • Copy and paste below command line in Terminal.

     ? () { echo "$*" | bc -l; }

  • Now simply type the question mark “?” and equation that you want to solve. If you are giving spaces, then you should add quotes around equation. If you do not use quotes then it will simply show you error.
  • If you have installed Cygwin then you can use this on your Windows and secondly you should have bc package as well.

Make function save in Terminal

If you are working over MAC OS X, then launch Terminal and write below commands in it:

touch .profile

open .profile

new.profile file will open in Textedit where you will have to copy and paste the command line. Save and quit Textedit.

Close Windows terminal and then open it again. Function should be present here.

Related posts

Security Application for iPhone 4

Realitypod

An Eye Of A Drop

Realitypod

Rhino Sculpture Made With Wine Corks

Realitypod