I need the bash script with comments so that I can complete the report based on it.
1. Overview For this assignment the student will write a BASH script that displays information from processes and/or threads. 2. Script Requirements Each student will write a Bash script which provides information to the user comparing the statuses of processes and or threads. The specific information to be provided to the user will be determined by the student but must display at least three different values. The script will use the information from the /proc directory to provide the output. The script will support multiple uses, which will include a help (-h or --h) option which will display basic usage information. The script must allow for and use at least 2 command line arguments (in addition to help). · Command line arguments can change the behavior of the script (e.g. choose what information to display – date, time, users, memory used …etc…). This should relate directly to which function is called. · Other command line arguments will be used to pass information to the script for searches (e.g. dates, times, user names, PID numbers …etc…). The script must include at least three functions. Some examples of comparisons the script may perform: - Display the two processes most nearly identical in terms of run-time, memory size, etc. - Display the processes which closely match specific input parameters for process attributes. - Display processes which were launched from a particular directory or directory tree, or which were launched from similar locations. - Display processes in adjacent or nearly adjacent memory locations. - Display processes where Usernames have matching characteristics. - Create an on-going list of all process names which have been used on the system. The script will follow the “Scripting Best Practices” as provided. 3. Process The bash script needs to be built and tested using appropriate entries. In addition, it is recommended that the student have another student test their script to ensure it works correctly. Submit a report following the standard format, along with a copy of the script. With the script completed and tested, discuss how the script could be used by a security professional to aid in spotting, researching, or analyzing a potential security issue. 4. References The following sources are useful in developing BASH scripts: Garrels, Machtelt. Bash Guide for Beginners. 2008. http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html#sect_01_02 (Links to an external site.) Chadwick, Ryan. Ryans Tutorials: Bash Scripting Tutorial. https://ryanstutorials.net/bash-scripting-tutorial/ (Links to an external site.) Banas, Derek. Shell Scripting Tutorial. YouTube. 2016. https://www.youtube.com/watch?v=hwrnmQumtPw (Links to an external site.) Nemeth, Evi et al. Unix and Linux System Administration Handbook, 4th Ed. Prentis Hall Upper Saddle River, NJ. 2011. Finally, type: man bash at the command prompt on any Linux/Unix system. The following resources are useful for figuring out what is in /proc: Krul, Rob. TechMint: Exploring /proc File System in Linux. 2015. https://www.tecmint.com/exploring-proc-file-system-in-linux/ (Links to an external site.) The Linux Documentation Project. Linux Filesystem Hierarchy: Chapter 1. Linux Filesystem Hierarchy: 1.14. /proc. 2018. https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html (Links to an external site.) Scripting Best Practices When run with inappropriate arguments, scripts should print a usage message and exit. The same message could be printed with a –help argument. Validate inputs and sanity check derived values. Return an appropriate exit code: zero for success and nonzero for failure. Use appropriate naming conventions for variables, scripts, and routines. User variable names that reflect the values they store. Start every script with a comment block that tells what the script does and what parameters it takes. Include your name and the date. If the script requires non-standard tools, libraries, or modules to be installed, list those as well. Comment at a useful level. More complexity requires more comments.