write a menu driven Bash script using: This program takes user input and to perf
ID: 3866538 • Letter: W
Question
write a menu driven Bash script using: This program takes user input and to perform simple arithmetic operations such as addition, subtraction, multiplication, and division of any two integers Part 1; SCRIPT SHOULD OBTAIN THE FOLLOWING TASKS Script file name: math.sh Clear the screen Enter the appropriate comments and descriptions Ask the user to input a value for each arithmetic calculation ; for example ,1 for addition and two for subtraction Use a CASE STATEMENT condition and the user input, complete the arithmetic operations print results of screen- must screen shot part 2- TEST PROGRAM GIve proper execute permission to run scriptwrite a menu driven Bash script using: This program takes user input and to perform simple arithmetic operations such as addition, subtraction, multiplication, and division of any two integers Part 1; SCRIPT SHOULD OBTAIN THE FOLLOWING TASKS Script file name: math.sh Clear the screen Enter the appropriate comments and descriptions Ask the user to input a value for each arithmetic calculation ; for example ,1 for addition and two for subtraction Use a CASE STATEMENT condition and the user input, complete the arithmetic operations print results of screen- must screen shot part 2- TEST PROGRAM GIve proper execute permission to run script
This program takes user input and to perform simple arithmetic operations such as addition, subtraction, multiplication, and division of any two integers Part 1; SCRIPT SHOULD OBTAIN THE FOLLOWING TASKS Script file name: math.sh Clear the screen Enter the appropriate comments and descriptions Ask the user to input a value for each arithmetic calculation ; for example ,1 for addition and two for subtraction Use a CASE STATEMENT condition and the user input, complete the arithmetic operations print results of screen- must screen shot part 2- TEST PROGRAM GIve proper execute permission to run script
Explanation / Answer
clear
echo "Menu "
echo "1. ADD "
echo "2. SUBTRACT "
echo "3. MULTIPLY"
echo "4. DIVIDE"
echo "5. EXIT"
echo "Enter ur Choice: "
read Choice
echo "Enter 1st number: "
read a
echo "Enter 2nd number: "
read b
case "$Choice" in
"1") c=$((a+b))
echo "result is: "
echo $c
;;
"2") c=$((a-b))
echo "result is: "
echo $c
;;
"3") c=$((a*b))
echo "result is: "
echo $c
;;
"4") c=$((a/b))
echo "result is: "
echo $c
;;
"5")
echo "Exit......."
exit;;
esac
Use this script.
to grant permission use
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.