2 sum echo n1 - n2 bc - l echo Sub is sum. Using the C Shell Im building a script that will compute simple mathematical computations addition subtraction multiplication division. Bin bash echo simple calculator sum 0 i y echo enter first number read n1 echo enter second number read n2 while i y do echo 1Addition echo 2Subtraction echo 3Multiplication echo 4Division echo Enter choice read ch case ch in 1 sum echo n1 n2 bc - l echo Addition is sum.
Here is my code.
Write a shell script to create a simple calculator using a switch-case statement. Simple Interest and Compound Interest are the ways of calculating the interest charge on the principal loan amount. Shell script variables are by default treated as strings not numbers which adds some complexity to doing math in shell scriptTo keep with script programming paradigm and allow for better math support languages such Perl or Python would be better suited when math is desired. Shell Program to simulate a simple calculator operations such as addition and multiplication.