Sections
Small calculator, on command line
Overview
The function below allows you to add the function calc shell. It is often convenient to have a small function to perform some simple operations, without having to search everywhere to find a calculator, or to launch a graphical gui. |
Just add the following line on ~/.bashrc file:
function calc() { awk "BEGIN { print $* }" }For running the program, you must use quotes.
Function usage example
calc '3+2'
Be careful
-
Since we have added the function in the .bashrc file, you have to logoff and logon.