----------------------- Exercise #1 for CST8129 due September 7, 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 Wednesday, September 7. The deliverables for this exercise are to be submitted online on the Course Linux Server using the submit 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 23h00 (11pm) on Wednesday, September 7. 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 September 7. Exercise Synopsis: Marks: 1% You will use "vim" to create a text file, read in another file, perform some simple edits, answer some questions, and save the result. Where to work: Do your Unix command line work on any WT127 workstation. The files you work on will remain in your account 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 a lab workstation *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 Linux machine. Location of the course notes on the Lab workstations: You can find a copy of all the course Notes files on any Lab workstation under directory: ~alleni/public_html/teaching/cst8129/05f/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 Lab workstations. (See above.) B. Complete the VIM tutorial and all the readings. Any questions? See me in a lab or post questions to the Discussion news group (on the top left of the Course Home Page). --------------------------------------------- Exercise Details (on the Course Linux Server) --------------------------------------------- 0. Have you done all the preparation steps? If not, go back and do them. File editing - exercise01text.txt ---------------------------------- 1. Using VI/VIM, edit a new file named exercise01text.txt on a Lab workstation. The spelling of the file name must be exact, othewise it won't be marked. The spelling must be exact. Exact! 2. 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). For full marks, follow the directions for the label exactly. The label has exactly 7 lines, plus an optional Comments line. The spelling of the label fields on the seven lines must be exactly as shown. The spelling must be exact. Exact! 3. Preface each of the seven lines of the label with the two characters "# " (octothorpe+space). The lines do not have to be numbered. Leave a blank line below the label. Do the following in your exercise01text.txt file below/underneath your Exterior Assignment Submission label: 4. From the file opt_why_shell.txt in the Notes directory use VIM to extract just the one 16-line paragraph that starts with the words "Back in" and include it in the bottom of your exercise submission file. (Hints: you could read the entire opt_why_shell.txt file into your exercise file and edit away the unnecessary lines, or, you could copy the opt_why_shell.txt file to a temporary file and edit away the unnecessary lines, then read the edited version into your exercise file.) Do not change the indentation, spacing, or formatting of this 16-line paragraph. Do not use a mouse-based copy/paste. (You won't have a mouse when you are setting up a bare-bones Linux network server.) Use the VIM command that reads in a file at the current cursor position (Hint: VIM tutorial Lesson 5.4.). Make sure a blank line separates the assignment label from your paragraph in this file. 5. Note the start and end line numbers of this single paragraph and use a single VIM command to globally change all occurrences of the three characters "and" to "***" in this paragraph only. (Hint: VIM tutorial Lesson 4.4.) Change *all* occurrences on each line. 6. Enter a full line of dashes across the bottom of your file, below the paragraph. 7. Enter the following questions into the file, below the line of dashes. Under each question, write your answers. 7a) True/False - shells handle wildcard characters under Unix 7b) What is a "token" to the shell? 7c) True/False - command substitution is done after variable substitution 7d) True/False - Unix processes share PID numbers 7e) What does the "fork" system call do? 7f) What do you type at the keyboard to terminate (interrupt) a process? 7g) True/False - variables are part of the "environment" of a Unix process 7h) True/False - your "umask" value is subtracted from default permissions 7i) What is the full Unix pathname of your Working Directory when you first log in? (You need to execute a command to show it.) 7j) Use a Unix pipe (p.28) to send the output of the "date" command into the input of the "wc" command. How many lines, words, and characters does it show? Note: You must have read the text_errata.txt file to get the correct answers to some of the above questions. The textbook is wrong. Submission ---------- Submit the finished and labelled exercise01text.txt file for marking as using the following Linux command line: $ ~alleni/bin/copy exercise01text.txt This program will copy the selected file to me for marking. You can copy the file more than once. Only the most recent copy will be marked. P.S. Did you spell all the label fields and file names correctly?