Write the output and function for following shell script and

Write the output (and function) for following shell script and

Solution

For ./q2.sh 3

The output of the program would be

Oops! I need atleast 2 command line args

Syntax: ./q2.sh: number1 number2 ... numberN

Example: ./q2.sh 56 66 34

Explanation: The script require minimum 2 arguments. If 2 args are not there the scripts exits giving the message.

In this case one argument \'3\' has been given, so the output would be as given above.

If the script is run using 2 arguments like:

./q2.sh 3 5 then the program would execute the happy path and calculate average of the numbers. In this case 3 and 5 are the numbers so (3+5)/2 i.e. 4 would be the output.

Write the output (and function) for following shell script andSolutionFor ./q2.sh 3 The output of the program would be Oops! I need atleast 2 command line args

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site