Question: Using Unix: 1. Write a script that tests for at least 1 or more arguments in the line calling the script. If there are 0

Using Unix:

1. Write a script that tests for at least 1 or more arguments in the line calling the script. If there are 0 arguments (use positional parameters), then notify user of the problem and exit status 1. If user puts in an argument, echo program running and exit with a status of 0.

**Deliverables: Copy and paste the script into a common text or doc file.

2. Write a shell script that copies the file named by its first argument (it must already exist) 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. Next, add a test routine to verify the user has used an argument that is a valid file and not a directory. If it is not then quit the script with an exit 1 status.

**Deliverables: Copy and paste the script into a common text or doc file.

3. Write a script that uses a for i type control structure to check all of the files in the directory /var/log/

Test if the file is a directory and has an executable permission, if true, echo the name of the file. Six directories should be returned.

**Deliverables: Copy and paste the script into a common text or doc file. Also show your output from running the command.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!