Question: 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

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!