Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Simple calculator and user interaction !bin/bash while [ -z $argl] entered #will be repeated until a data will be read P Enter argumentl:arl done while

image text in transcribedimage text in transcribed

Simple calculator and user interaction !bin/bash while [ -z "$argl"] entered #will be repeated until a data will be read P Enter argumentl:arl done while [ -z "arg2"1 entered #will be repeated until a data will be read -p "Enter argument2: arg2 done echo "You've entered: argl-$argl and arg2-arg2" let "addition-argl+arg2" let "subtraction-argl-arg2" let "multiplication-argl arg2" let "division-argl arg2" let "reminder-arg1 % arg2" echo -e "results: " echo "$argl+arg2-$addition" echo "$argl-$arg2-$subtraction" echo " $argl arq2-multiplication" echo " argl/arq2- (division+Sreminder/arg2)" (Script 1) MODIFY the script provided above so that it would perform operations"+","-", "*", "7" (only the whole part of the division operation, ignore the reminder part) and "A" (power). Implement the power operation, probably in the form of some sort of loop operations. Once you write the script, you will be required to upload it to the scriptcheck.cms.gre.ac.uk system for test purposes. The marking system will assume that the script will be processing three command line parameters, one for the first argument of arithmetic operation, the second command line parameter for the second argument of the arithmetic operations and third parameter expressing the arithmetic operation to be processed. Your script will be executed from the command line, for example, in order to check if your solution is correct it might be executed as: scriptname 4 2 "operation" The scriptcheck system will check if shading ipt returns appropriate results for each operation; for the example execution parameters (4 and 2) it should return: 42"16 The only thing your script is expected to return is a number corresponding to result of a given operation. Neither, runtime messages nor error messages should appear on the screen (you may need to re-direct the standard error stream for operations that might be source of any kind of error as "command 2>/devull")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

7. It is advisable to do favors for people whenever possible.

Answered: 1 week ago

Question

9. Power and politics can be destructive forces in organizations.

Answered: 1 week ago