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
If you just want to wrap your code in a Bash looping construct, and are willing to hit CTRL-C to terminate the loop rather than do something more fancy, then you can wrap your code in a while-loop. For example:
while true; do
: # Your code goes here, inside the loop.
done
Just make sure to move your unconditional exit
statement out of the body of the loop. Otherwise, the loop will terminate whenever it reaches that line.