Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a Linux exercise is anyone can show me how to do it? Use vim or cat (see page 16 of this lab manual

This is a Linux exercise

is anyone can show me how to do it?

Use vim or cat (see page 16 of this lab manual for instructions) to create a file named short with the following line in it:

 echo 'hi there' 

Use cat to verify the contents of short and then try to execute it. Use ls l to display the permissions for short. Read the tip on Sobell, page 286.

Use chmod (Sobell, pages 99 and 285) to make the file executable, display the permissions for short, and try executing the file again.

Add a line that starts with #! (Sobell, page 287) to the beginning of short to make sure it is executed by bash.

Add a comment line (Sobell, page 288) to short that explains what the script does.

Within a shell script, the shell expands $1 (a variable called a positional parameter; Sobell, page 462) to the first argument on the command line the script was called with. Write and execute a script named first that displays (sends to standard output) the first argument on the command line it was called with. Include the #! line and a comment. Remember to make the file executable.

Write a shell script that copies the file named by its first argument to a file with the same name with the filename extension of .bak. Thus, if you call the script with the argument first (and a file named first exists in the work- ing directory), after the script runs you would have two files: first and first.bak. Demonstrate that the script works properly.

Read the caution titled Always quote positional parameters on page 462 of Sobell. Use touch to create a file whose name has a SPACE in it. What hap-

pens when you give that filename as an argument to cptobak from the

previous step?

Modify the cptobak script from the previous step by quoting the positional parameters in the cp line. Now what happens when you use the script to make a copy of a file with a SPACE in its name?

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

gave answer without involving Ai contentt 4 9 5 .

Answered: 1 week ago