Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project involves writing several bash scripts that take parameters and do a task. They each require input checking and validation. A . [ 2

This project involves writing several bash scripts that take parameters and do a task. They each require input checking and validation.
A.[20 points] Write a script named fileChecker.sh that will do the following:
take a name of a directory as a parameter and a string (make sure to verify that the first parameter is a directory, output an error message and terminate, same if more than two parameters is given. The second parameter can be anything).
loop through all files in this directory and display their names. However, if one of the names exactly matches the second parameter, output INVALID FILE EXISTS and terminate the script.
For all of the files in that directory, also display only those files that contain (but do not exactly match) the second input string. Do so with the following message WARNING: Danger detected in name X, where X is replaced with the actual name of the file that contained our second argument.
B.[20 points] Write a script named fileInfo.sh to give a user information about all arguments given to the script. Note that it could take in any number of command line arguments. Your script should do the following, for each argument:
Inform the user if the argument is a regular file, a directory or a special file.
If it does not exist as a file or directory, check to see if it is currently a user logged into the system. If so, inform the user.
Perform each of the above operations as a function, that is pass the relevant argument to a function and have that particular function do the task.
Make calls to the function using a loop on the list of files specified as positional parameters.
If the user does not specify any parameter, print the usage line and exit with non-zero status. When I say a usage line, I mean an error message that indicates exactly the type of data that the script is supposed to take in.
Please submit the scripts, as well as screenshots showing you running the script on delmar.

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Answered: 1 week ago

Answered: 1 week ago

Question

6. The cost of the training creates a need to show that it works.

Answered: 1 week ago