troubleshooting Question

Shell script that implements a simple calculator for integer arithmetic.

Avatar of djwburr
djwburr asked on
Scripting LanguagesShell Scripting
5 Comments1 Solution4252 ViewsLast Modified:
Hey Guys/Gals... I'm interested in writing a shell script that implements a simple calculator for integer arithmetic. The calculator should prompt the user and receive its input in following manner:

Enter the first operand: 4
Enter an operator: *
Enter the second operand: 3
Answer: 4 * 3 = 12
Assume that in this example the user entered 4, * and 3 in response to the scripts prompting.
The permissible operators that the calculator should be able to handle are: +,-,*,/ and %. The
calculator should continue running until the user enters the character x at any of the prompts.

Thanks in advance for your help!

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros