Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CAN SOMEONE PLEASE HELP ME DO THIS STEP BY STEP USING THE TERMINAL IN MACBOOK AIR Exit from script, if is currently enabled; if it

CAN SOMEONE PLEASE HELP ME DO THIS STEP BY STEP USING THE TERMINAL IN MACBOOK AIR

Exit from script, if is currently enabled; if it is not enabled, skip this item (1)

Using the vi editor, create a shell script file that displays the first 12 command line arguments. You must use a while loop, expr and shift shell commands in the script to do this question.

Issue script command to capture the output of the items below

Add execute permission to the file

Display the attributes of the script file

Display the content of the script file

Run the script file by typing the name of the script file and specifying 14 or more arguments

The following are helpful hints in creating the shell script file for this question:

The expr command can be used to perform arithmetic operations. For example, the value of a user defined variable, count can be incremented by 1 (that is, add 1 to count) by using the following expr command.

count=`expr $count + 1`

NOTE: (1) there should be no space before and after = when storing a value into a variable, (2) Reverse quote (`) is used and not forward quote () in the above command.

Following are the relational operators that can be used in shell scripting:

Operator Description Operator in Java and C++

-eq equal ==

-ne not equal !=

-lt less than <

-le less than or equal <=

-gt greater than >

-ge greater than or equal >=

The test command is used to evaluate the value of an expression. Value of an expression with the above relational operators will be a Boolean value, true or false. The following test command checks whether the value of the variable count is less than 12:

test $count -lt 12

Alternately, the square brackets [ ] can be used instead of the word test to evaluate an expression. For example, the above test command can be issued as follows using square brackets:

[ $count -lt 12 ]

Note, there must be space before and after [ and ], before and after lt and after 12 in the above statement.

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

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

5 Name at least three recruitment methods.

Answered: 1 week ago

Question

5. Tell how job experiences can be used for skill development.

Answered: 1 week ago

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago