I am trying to make a calculator with a bash script. The user enters a number, chooses whether they wish to add, subtract, multiply or divide. Then the user enters a second
How about this
calc () { (( d = $1 )) echo $d }
output
$ calc '6 + 2' 8 $ calc '6 - 2' 4 $ calc '6 * 2' 12 $ calc '6 / 2' 3