Question: ommand-line Bash Scri Create a script called InformationExtractor.sh that will be used by you to automate the process of searching and filtering information then logging


ommand-line Bash Scri Create a script called InformationExtractor.sh that will be used by you to automate the process of searching and filtering information then logging it to a log file. This bash script will be used at the command-line as follows: ./InformationExtractor.sh directorvName Where directoryName is provided by the user at the command-line and is the directory name where the information will be stored. The directory name must be a single word (it cannot have spaces or other white characters) The script will do the following in this order: Clear the screen Next, using absolute path, the script changes directory to your home directory Next, it verifies whether a subdirectory called directoryName exists. If it does not exist it creates that directory, Next, it changes directory moving into directoryName using relative path Next, it verifies whether a file called extractor.log exists. If it does not exist it creates that file which will serve as a log file where we log information regarding the execution of our script, Next, it verifies whether a file called Information exists. If it does not exist it creates that file which will serve as the file where we store the needed information. Next, the script should write to the log file the following message: "Information file already exists" if the file already existed or "Information file is created" otherwise Next, the script should change the access rights to the file Information so that the owner can read and write, the group members can only read and no access rights for all the others Next, the script should append to the log file the following message: "Access right changed for Information file". Next, the script will check the list of all the users connected to the server and write to the Information file the list of users of only those having one of the following letters in their user names: a, b, c or d. The list should consist of usernames only without any other related information. Next, the script should append to the log file the following message: "List of user names has been added to the Information file" Next, the script should append to the log file the number of users that were listed previously: The number offound users is: xx". Where xx is the number. Finally the script terminates by displaying to the screen: "Execution of InformationExtractor script has ended successfully
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
