Jun
4

How to build a terminal based calculator in Linux.

To build a terminal-based calculator, add the following function to your ~/.bashrc file.

vi ~/.bashrc

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

Reload Bash profile using the following command:

$ source .bashrc

Now run calc from terminal as :

$ calc 4+7*9-10/5

You will get the following output:

65.00000000000000000000

Easy enough?

1 Comment to “How to build a terminal based calculator in Linux.”

Post comment

Follow us on Twitter! Follow us on Twitter!
http://twitter.com/efheem
The next version of Ubuntu is coming soon

Recent Posts

Recent Comments

Firefox Download Button
Google Analytics Alternative Add to Technorati Favorites Technology Blogs - BlogCatalog Blog Directory Free Hit Counter Technology Google Analytics Alternative Blog Buzzer