======================= CST8129 Lab Exercise #5 (Week 7) ======================= -IAN! idallen@ncf.ca Due: demo scripts in lab period only - no hand in Marks: 2% Late penalty: 100% after last lab on Friday this week. Purpose: - review some of the work done so far (Chapter 8 and 9) (Warning - priority is given to people who are registered in a given lab section. If you are trying to give a demo in a section that is not your registered lab section, you must wait until after all the registered students have done their demos and have had their questions answered.) -------------------------------------------------------------------------- TODO: Make the folowing modifications to the scripts you typed in as the last part of last week's lab assignment: p.411 - 9.21 - Modifications: - Use the text_errata.txt file to fix the errors in the given script. - Change part of the comment at the top to read: "...to find any files in your home directory..." - Put the constants 0, 20, and 30 in appropriately-named shell variables at the top of the script and use the variables wherever the constants are needed in the body of the script. (Always use the variables.) - Fix the poor error messages: - Add the variable containing the name of the script to the beginning of all error messages. - Make the error message text appear on standard error, not stdout. - Remove the words "out of range" and replace them with the actual number and the actual range in each error message, for example: modify days '42' is not between 0 and 30 Each error message should show the number the user typed in, as well as the range or value against which the user's number was compared. - Change the root directory used in the last line to be your home directory, using the appropriately named environment variable. p.414 - 9.24 - Modifications: - Replace the first line with a simpler method of putting just the numeric user ID into the variable named "id". (Hint: Get rid of the huge gawk line and use an appropriate option to the "id" command instead. Less code is better code!) p.416 - 9.25 - Modifications: - Fix the program logic: Remove the redundant tests (the tests that will always be true) from the IF and ELIF statements. Less code is better code!