----------------------- Exercise #2 for DAT2330 due November 9, 2004 ----------------------- -Ian! D. Allen - idallen@idallen.ca Remember - knowing how to find out an answer is more important than memorizing the answer. Learn to fish! RTFM! (Read The Fine Manual) Global weight: 3% of your total mark this term Due date: 10h00 (10am) Tuesday November 9, 2004. The deliverables for this exercise are to be submitted online on the Course Linux Server using the "datsubmit" method described in the exercise description, below. No paper; no email; no FTP. Late-submission date: I will accept without penalty exercises that are submitted late but before 10h00 (10am) on Thursday, November 11. After that late-submission date, the exercise is worth zero marks; but, it must still be completed and submitted successfully to earn credit in the course. Exercises submitted by the *due date* will be marked online and your marks will be sent to you by email after the late-submission date. A sample answer will be posted online after the late-submission date. This exercise is due on or before 10h00 Tuesday November 9, 2004. Exercise Synopsis: You will use "vim" to create some executable shell scripts. These scripts are slight variations of the first few practiceCommands_2.txt scripts that you have already completed. Where to work: Do your Unix command line work on the Course Linux Server. Do not use ACADUNIX. The files you work on will remain on the server even after you log off. Do not erase your files after submission; always keep a spare copy of your exercises. WARNING: Do not attempt this exercise on a Windows machine - the text file format is different. You must connect to and work on Unix/Linux. Note that you may connect to the Course Linux Server *from* a Windows machine (using PuTTY); however, you may not use the Windows machine itself to do your work. Use the vim editor on the Course Linux Server. Location of the course notes on the Course Linux Server: You can find a copy of all the course Notes files on the Linux Server under directory: ~idallen/public_html/teaching/dat2330/04f/notes/ You can copy files from this directory to your own account for modification or study, if you like. (To avoid plagiarism charges, you must credit any material that you copy and submit unchanged.) Exercise Preparation: A. Know where to find an online copy of all the course Notes on the Course Linux Sever. (See above and in course_linux_server.txt) Do not use the ACADUNIX computer for this exercise. B. Do *not* create temporary files if using a Unix pipe would work. -------------------------------------------------------- Exercise Details (to be done on the Course Linux Server) -------------------------------------------------------- Have you done all the preparation steps? If not, go back and do them. Using VI/VIM, edit and create new executable script files on the Course Linux Server. The spelling of each script file name must be exact, othewise it won't be marked. The spelling must be exact. Exact! -------------------- For all script files -------------------- Make sure each executable script file you write starts with the three necessary parts of a DAT2330 executable shell script. Make sure the file is executable (at least by you, the owner). Near the top of each script file, create an Exterior Assignment Submission label in shell comments, as you have done in previous exercises. The commands that implement your solution to a script problem must appear after (below) your Exterior Assignment Submission label in the script file. --------------------------- Script name: labelcheck1.sh --------------------------- Marks: 1 of 3% Begin the labelcheck1.sh script as given above in "For all script files". This script does a quick check for simple spelling errors in the field names of the Exterior Assignment Label. The script will examine the file given as the first (and only) argument to the script ("$1"). Write commands that check the spelling of the field names used in each of the seven lines of the Exterior Assignment Label (i.e. check for "Student Name", then for "Student Number", etc., in the given file argument). The script should contain Unix commands that look for the correctly spelled field names. (If the field name is spelled incorrectly in the file, your script will not be able to find it.) The script should take the file to check as an argument on the command line. When you run this script, if you get seven lines of output, you know you have spelled the seven field names correctly. $ ./labelcheck1.sh exercise01commands.sh | wc -l 6 - Only six lines? One of the fields must be spelled incorrectly in the exercise01commands.sh argument file. Hint: Write seven Unix commands. Each command tries to find one of the seven field names in the argument file. If all the field names are spelled correctly, the script will produce seven lines of output. If any field is not spelled correctly, no line of output will appear for that field. --------------------------- Script name: tuxdrinks1.sh --------------------------- Marks: 2 of 3% Begin the tuxdrinks1.sh script as given above in "For all script files". Follow the directions in the file named README.txt under the directory named image in the home directory of idallen on the Course Linux server. (The README.txt file was updated on November 4.) ------------- Documentation ------------- Above each of the command lines you wrote in each script file insert a one-line (less than 80 characters) comment summarizing briefly what the expected output is for the comand or pipeline that follows. Script lines with incorrect or missing comment lines will not be marked. ---------- Submission ---------- Submit all the executable script files for marking as Exercise 02 on the Course Linux Server, using the following *single* datsubmit command line: $ datsubmit 02 labelcheck1.sh tuxdrinks1.sh This "datsubmit" program will copy all the selected files to me for marking. Always submit all your files at the same time. Do not delete your copies; keep them. Verify that you submitted all your files. P.S. Did you spell all the label fields and file names correctly?