----------------------- Exercise #2 for NET2003 due January 17, 2005 ----------------------- -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: 1% of your total mark this term Due date: Before the end of your Lab period on Monday, January 17. 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 21h00 (9pm) on Monday, January 17. After that late-submission date, the exercise is worth zero marks. 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. This exercise is due before the end of your Lab period on January 17. Exercise Synopsis: Marks: 1% You will use Unix commands to alter the text in one of the course notes files, perform some simple edits, and save the result. Where to work: Do your Unix command line work on the Course Linux Server. 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/net2003/05w/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: Same as last week. --------------------------------------------- Exercise Details (on the Course Linux Server) --------------------------------------------- 0. Have you done all the preparation steps? If not, go back and do them. Part I - exercise02cmds.txt ------ 1. Fetch a copy of the unix_command_list.txt file from the course notes directory and sort this file into a temporary file. (Remember - never redirect the output of a command into one of its input files! See Notes file redirection.txt .) 2. Edit away lines for commands that we haven't covered yet, leaving only the commands that I have mentioned in Week 1 and Week 2. (Deleting a line is a two-character command in VIM.) 3. Remove the leading numbers from the lines. (Deleting a word is a two-character command in VIM.) (Hint: In command mode, a period repeats the last change you did in VIM.) 4. Save and sort the file again to put all the names in order. 5. After each command name that remains, type a dash followed by a short, one-line summary of what the command does, written in your own words. (You should already be keeping this list as part of your class notes. RTFM as needed.) The single line must be less than 80 characters. Example format: date - print the current date and time who - show who is logged on Use your own words; do not copy words from the manual pages or from other students. 6. At the top of the file, create an Exterior Assignment Submission label following the example you will find under the "Assignment Standards" button on my teaching home page (teaching.idallen.com). 7. Preface each of the seven lines of the label with the two characters "# " (octothorpe+space). The lines do not have to be numbered. 8. Rename the file to be called exercise02cmds.txt Part II - exercise02out.txt ------- 9. At the top of the exercise02out.txt file, create an Exterior Assignment Submission label. 10. Copy the Notes file argv.sh.txt into your home directory under the name "argv". Turn on execute permissions on this shell script: $ chmod +x argv Read the comments at the top of the script. 11. Based on the syntax line given at the top of the script, how many arguments are required (mandatory) for this script? Place a copy of this question and the correct answer in the exercise02out.txt file, below the label. 12. Near the end of the Notes file quotes.txt there is a question that asks "How many arguments are there to the following echo command?" The file says to use the argv program to help you find the right answer. On the course linux server, use the following command line in place of the one given, and copy the question and the output of the argv program into the end of the exercise02out.txt file: $ ./argv GLOB pattern is /usr/lib/libc* The above command outputs approximately 73 lines. Use shell appending redirection to capture the output into your exercise02out.txt file. Submission ---------- Reference: datsubmit.txt - Using the datsubmit command Submit the finished and labelled files file for marking as Exercise 02 on the Course Linux Server, using the following datsubmit command line: $ datsubmit 02 exercise02cmds.txt exercise02out.txt This "datsubmit" program will copy the files to me for marking.