Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Teach me how to do it 1. Use vim or cat to create a file named short with the following line in it: echo 'hi

Teach me how to do it

1. Use vim or cat to create a file named short with the following line in it: echo 'hi there'

2. Use cat to verify the contents of short and then try to execute it. Use ls l to display the permissions for short.

3. Use chmod to make the file executable, display the permissions for short, and try executing the file again.

4. Add a line that starts with #! to the beginning of short to make sure it is executed by bash. 5. Add a comment line to short that explains what the script does.

6. Within a shell script, the shell expands $1 to the first argument on the command line the script was called with. Write and execute a script named first that displays the first argument on the command line it was called with. Include the #! line and a comment. Remember to make the file executable.

7. 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 working directory), after the script runs you would have two files: first and first.bak. Demonstrate that the script works properly.

8. 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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions

Question

Know how productivity improvements impact quality and value.

Answered: 1 week ago

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago