This lab walks you through building a simple file system scanner. The scanner willbe able to do three things. First, it will generate a list of files and file attributes,including a checksum of each file’s contents. Second, it can compare the files andfile attributes of the files in the directory with that list. Third, it can delete thatlist.For this lab you will need the five files in the subdirectory “sample”. Please do notchange anything in that directory — one of the tests you need to run depends onthose files being unchanged.? abc xyz? abcde? demofor? demofor2? demofor3LAB EXERCISE 1This exercise starts you off. You do not need to write any scripts until Part D.First, list the attributes of the files in the directory “sample”, one per line.A. When you execute the commandls with the–l option, which of the desiredattributes are printed?B. What does the commandsha512sum print?C. How would you cause both outputs to be printed on the same line?D. Write a shell script that uses afor loop to list the attributes of the files inthe directory “sample”, one per line. Call this script “scan1.sh”.Run your script. You should get information for six files, including the one youwrote. The checksums of the files “abcde” and “demofor.sh” are:da39a3ee5e6b4b0d3255bfef95601890afd80709 abcde031b3606cf69ac7144a6fc47e9495d690b669084 demofor.shLAB EXERCISE 2You are now going to modify the script you wrote for Lab Exercise 1D to see if amaster file exists and, if it doesn’t, create one. Then, in the loop, you will ignoreany non-regular files and the master file.A. At the beginning of the script, add a line that defines a variable calledMASTER, and give it the initial value “MasterList”. Call this script“scan2a.sh”. When you are done, save a copy because you will use this inLab Exercise 3.B. After the variable definition but before your loop, test to see if the filenamed by the value of the variable MASTER exists. If so, print the messagethat the file “exists; please delete it” and exit, giving exit status code 1. Ifnot, create it. Call this script “scan2b.sh”.C. In thefor loop, before you print the file attributes, check to see if the filebeing examined is either a regular file or the MasterList file. If it is neither,immediately go to the next file (that is, do not get the file attributes). Callthis script “scan2c.sh”.D. Modify your script so that the attributes are stored in the file named by thevalue of the variable MASTER. Call this script “scan2d.sh”.E. Finally, if everything works, have the script exit with an exit status code of0. Call this script “scan2e.sh”.Run your script. There should be no output. Then look for a file called MasterListand compare its contents to what you got for the output of script1.sh. The outputsfor the files abc xyz, abcde, demo.for.sh, demofor2.sh, and demofor3sh should bethe same. The other files that are present should all be ones you created or putthere.LAB EXERCISE 3This exercise uses the copy of the script you saved after completing Lab Exercise2A. We will be modifying it in a way similar to the rest of Lab Exercise 2.A. At the beginning of the script, add a line that defines a variable called TMP,and give it the initial value “/tmp/$$”. Then add another line that createsthe file named by the value of TMP. Call this script “scan3a.sh”. What is theactual name of the file created?B. In theforloop, before you print the file attributes, check to see if the filebeing examined is the file named by the value of TMP, and if so,immediately go to the next file (that is, do not get the file attributes). Callthis script “scan3b.sh”.C. Modify your script so that the attributes are stored in the file named by thevalue of the variable TMP. Call this script “scan3c.sh”.D. After the loop, print the message “Changed files:”, and then compare thecontents of the files named by TMP and MASTER. Usediffto generate thecomparison. Call this script “scan3d.sh”. What happens if the file named bythe value of MASTER does not exist?E. Before the loop, check that the master file (the file named by the value ofMASTER) exists. If it does not, print an error message saying “Master filedoes not exist; please generate it” and exit with an exit status code of 1.Call this script “scan3e.sh”.F. Conclude by using the commandrm to delete the file named by the valueof TMP after the comparison in Part D. Again, have the script exit with anexit status code of 0. Call this script “scan3f.sh”.When you test this script, the MasterList file must already exist. If it doesnot, execute the script you wrote in Lab Exercise 2.You should get at least one line for the file MasterList. You will also getother lines corresponding to the scripts you wrote. As long as you get theline for MasterList, you’re doing it right.Also, from the command interpreter, check the exit code. Immediately afteryou execute your script, typeecho $?This prints the exit status code of the command that finished most recently.That command is your script. So you should see 0.