Is it possible to do something like this (somehow set up the shell) so that in the terminal you can type expressions like a * b , a + b , a - b , a / c , where a and b are numbers, and what Is this expression evaluated?
Those. what could be done like this:
dzmitry@mycomp:~$ 12 * 45 And not running, for example, a python:
dzmitry@mycomp:~$ py Python 3.4.3 (default, Oct 14 2015, 20:28:29) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 12 * 45 540 >>> Those. I do not use a calculator, but I use a command shell with a running python, and I want to use the command shell as a calculator, minimizing intermediate steps
echo $((12 * 45))ora=$((12 * 45)); echo $aa=$((12 * 45)); echo $awill print 540, and with variables,echo $(($a-10))will print 530. Those. The@(( ... ))construct evaluates an expression with integers in brackets right in the shell. - avpbc(or Emacs Lisp)). And the given information about the shell is more applicable when writing scripts (instead of callingexpr) - avp