Test #2 Shell Programming DAT2330 - Ian Allen - Fall 2004 -1- 100 minutes Shell Programming - Points: 64 (6 of 15%) Write code for an executable shell script that will do the following actions, in the exact order given below. (You will write approximately 17 lines of executable code, plus a step number comment before each step.) For full marks, you must put a one-line comment containing the step number in front of the executable code in each step. Do not put a Step Number comment as the first line of the file! ________________________________________ 1. [Points: 3] Start your script with all the parts of a correct DAT2330 executable script header. 2. [Points: 1] Display the current working directory. 3. [Points: 2] Display your full name and your Algonquin (not Hotmail) email address. 4. [Points: 2] Display the command search path used by this shell script. 5. [Points: 4] Display the current date with UPPER CASE letters. 6. [Points: 2] Display this punctuated sentence on the screen: It's a nice "day" today. The exact punctuation shown must appear on the screen. 7. [Points: 6] Calculate and display one number that is the count of files of type script in the /bin directory. (One number only.) 8. [Points: 6] Extract and display a list of the unique shells from the Unix password file. (Hint: Each field in the password file is delimited [separated] by a colon character. Your Running Linux textbook tells you what each field means.) 9. [Points: 7] Display a list of the unique days of the week on which this machine was rebooted. (Hint: See a similar question in Exercise #1.) 10. [Points: 11] Calculate and display the five most used fields in the Unix password file along with the count of how many times each field was used in the file. The output should be sorted in descending order by count. (Hint: Each field in the password file is delimited [separated] by a colon character. Process the file to put each field on its own line first.) 11. [Points: 2] Make a copy of the above working pipeline. Change the copy of the pipeline to display only the five most used pathnames in the password file. (Pathnames must contain a slash.) 12. [Points: 9] Fetch the formatted web page named openformats.txt from the HTTP (Web) server at idallen.com and store the formatted web Script Programming DAT2330 Unix Test #2 - 15% 100 minutes DAT2330 - Ian Allen - Fall 2004 -2- 100 minutes page in a temporary file. Calculate and display a count of the number of lines in the file that contain the phrase Microsoft USA. (Display only one single number.) 13. [Points: 3] Using the above temporary file, extract and display all lines containing the word http preceded by a space character (a five-character search pattern). 14. [Points: 2] Remove the temporary file. 15. [Points: 4] Display your numeric Unix userid number (a single number). (Hint: You can find this number in the output of the id command or by looking for your userid in the Unix password file and displaying the correct field from that file.) Did you add shell script comment lines in front of every step? - FIN - Script Programming DAT2330 Unix Test #2 - 15% 100 minutes