Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a function called cal_cube in C shell script that uses the first argument/parameter to calculate the cube of the integer the user enters

1. Write a function called cal_cube in C shell script that uses the first argument/parameter to calculate the cube of the integer the user enters when running the script. If the script is called cube.sh, then the user will run it as follows from the prompt and the output should be shown as printed after the command.

$ cube.sh 3

Number 3

Cube 27

2. Write a script in C shell that presents a user with a menu as follows:

Add the numbers (enter a or A)

Subtract the numbers (enter s or S)

Multiply the numbers (enter m or M)

Divide the numbers (enter d or D)

Exit (select e or E)

If the user enters any other character other than the ones mentioned, then print an error saying it is not a choice and ask the user to select again until the correct option is chosen.

Once the operation is done, ask the user if they want to do another operation on the same two integers or do another operation with two different integers or exit. Do accordingly based on the users choice. So until the user does not select the exit option, the user is presented with a menu. Also, when you run the script, provide two integers as command line arguments. The beginning of your script should have an if statement that checks how many arguments are coming in and present a few statements about the usage of the script if the number of arguments is not 2.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions