EN
Bash - how to write simple calculator?
16
points
Using bash it is possible to write simple calcualtor in following way.
1. In brackets expression example
calcualtor.sh
file:
#!/bin/bash
set a b operation;
echo -e "Select operation type: + - * /";
read operation;
echo "a=";
read a;
echo "b="
read b;
echo "Result:" $(($a$operation$b));
Running:
$ ./calculator.sh
Select operation type: + - * /
+
a=
3
b=
6
Result: 9