Simple command-line calculator for tcsh/bash :


I have for some year used a simple alias for the calculator command.  The alias only requires awk, and that tcsh  (or csh) is the running hell.  This alias will not work with bash/sh/ksh since these shells do not allow arguments in aliases. Just place the following line in  your ~/.tcshrc  or type at the prompt:


At a recent meeting in SSLUG (1997) I was given the idea to use functions for making a bash equivalent of the above "calc" alias.  In ~/.bash_profile : It is nescesary to use quotes if the expression contains () or * :

calc "(3+5) * 4/5"