Hello everyone, Here are the tutorial notes for this week. Remember, feel free to contact me if you have any questions about the material. You don't have to email me after your tutorial this week, but if there are any problems please let me know about them. Reminders ========= - Assignment 1 went out last week and is due next week. (Lionel: since you will be marking A1, I will contact you later this week about scheduling lab hours to answer student questions.) Tutorial 2 Notes -- June 1 ========================== (1) Assignment 1 - Assignment 1 went out last week and is due next Wednesday (June 8). If you haven't had a chance to look it over you should probably do so before your tutorial. There is also a page of clarifications that I'll be updating before Wednesday. I've already had a number of students email me with questions so I expect that there will be questions during your tutorials. If you have any concerns about the assignment, please let me know. You can get the assignment from: http://www.cs.toronto.edu/~rpetrick/csc209/a1/ and http://www.cs.toronto.edu/~rpetrick/csc209/a1/clarify.html Here are a few notes: - Questions 1 and 2 involve writing shell scripts (using "sh"). There is nothing too tricky about either question, but rather, I want the students to focus on the ideas we've covered in class. For instance, you should stress that they should use built-in shell features whenever possible, rather than hunting for other Unix commands we haven't discussed in class. In Question 1, the only part they really have to think about is how to delete entries from the .mymacrorc file. I'm not really looking for anything too efficient so if they choose to copy the file line by line to a temporary file, leaving out the line that is being deleted, that's okay. In Question 2, the tricky part is realizing that they will have to use the "file" command to determine the file type if the -t flag is used. They will have to check for themselves what the output of "file" looks like, and determine what they have to check for in this output. For instance, running "file" on a text file might produce the output: t1.txt: ASCII English text and so they might need to search for the keyword "ASCII". You can tell them that they could (and should) use "file", but they have to figure out *how* to use it themselves. In Question 3 I'm getting them to write a man page with appropriate markup. You can tell them that they shouldn't just hand in a file that *looks* like a man page, but instead it should actually be formatted using the proper markup language. - Have a discussion with your students about program style and testing. You can tell them that they should follow good design practices (i.e., choose appropriate variable names, include white space, display error messages for incorrect input, document code appropriately, etc.). In particular, stress to your students the importance of writing comments in their code. You can mention that we expect comments in their programs/scripts, and that they will definitely lose marks if there aren't any comments. You might want to take a look at: http://www.cs.toronto.edu/~rpetrick/csc209/design.html and go over the points that apply to shell scripts. - Point your students to the document about submitting their assignments electronically: http://www.cs.toronto.edu/~rpetrick/csc209/submit.html Mention to them that they should test out the submit facility early on so that they don't run into any problems when they submit the final versions of their assignments. - Do the best you can to answer any questions they have about the assignment. (2) Shell programming examples - We covered shell programming in lecture last week and will continue the discussion this week, however, we haven't gone over many examples. This week I'd like you to present a few simple shell scripts to your students. Take a look at the examples on Karen Reid's webpage: http://www.cdf.utoronto.ca/~csc209h/winter/examples/shell.html I would recommend going over the various "readloop" examples and "case". (We looked at "args.sh" and "setDate.sh" in lecture.) Although some of these scripts are quite simple, they do have some interesting features, e.g., the "readloop" examples involve loops, getting input from the user, "escaped" characters, and executing other Unix commands; the "case" example includes the use of "expr" as well as some basic pattern matching. Feel free to build on these examples or come up with your own if you wish. (If you have an example you want to share, let me know and I'll put it on the course webpage.) - I'm hoping by now that most people know how to run a script, but you may want to point out the basics: (a) there is no compile phase for shell scripts, (b) the first line of the shell script must contain a path to "sh"; the path can be located using the "which" command, (c) files need to be executable; the executability of a file can be set using the "chmod" command, (d) running a shell script is similar to running any other Unix command, i.e., it must be in your path or you should specify the path directly. (3) Other topics (time permitting) - If you want to cover another topic, you could remind them about the different types of quoting (see slides 15-17 in the Week 2 lecture notes), i.e., how "...", '...', and `...` all differ. - You could also review file permissions. I briefly talked about this in class but I know some people were confused. You could put the figure from slide 37 of the Week 1 lecture notes on the board and just mention the three levels of security (user, group, world/other), and how to set the appropriate "bits" using "chmod". (E.g., explain what "chmod 754 file" means.) Note ==== - This is the last week we'll be covering shell scripts. Next week we'll be starting C programming.