Turn in Homework Assignments via Unix Command Line for Students


Overview


Turnin is a program which students use to hand in their homework assignments for a class via the Unix command line. The instructor has to make certain preparations for the use of turnin, so do not use it unless instructed by the professor. Turnin works by copying a file into a special directory in the class umbrella. The directory is under the control of the instructor or TA. Assignment deadlines may be enforced.

Turnin works well in situations where students only need to hand in one file per assignment. In more complex situations, for example where students are required to hand in a a set of files or a directory hierarchy, there is an instructor configurable utility called Bundle which acts as a front-end to turnin.

Critical Concepts


Turnin on Linux lab stations

It is not possible to use turnin on a linux lab workstation.
If you are on a linux workstation, please ssh to ieng6.ucsd.edu or ieng9.ucsd.edu and run turnin from the command line.

Caution

It is not possible to submit a set of homework files by running turnin once for each file. Each successive run of turnin overwrites what was previously turned in. This can be useful if you turnin an assignment and later wish to replace that submission with something better.

Steps To Take


How to Use Turnin

The usage for turnin is designed to be flexible. The syntax for simple, direct use of turnin is:

turnin [-c courseid] [file]

The courseid is a code (such as cs181w) which identifies the course for which the file is being turned in. The courseid can easily be determined using the allocations command.

allocations

This will report the course allocations associated with your account. OCE accounts typically will have more than one course allocation, but it should be easy to pick out the courseids for each class. The courseid used for the turnin command is the same courseid that you would use when doing the prep command for an OCE compatible class. In fact, if you have done a prep command and you do not specify a courseid to turnin, turnin will ask you if the prep'd class is the one to which you want to submit your homework file.

Submitting Multiple Files

The recommended approach to submitting multiple files or directories involves using the "bundle" mechanism described in the online help bundle articles. Bundle requires additional setup by the instructor. Another alternative is to use the tar command in conjunction with turnin. This requires less setup by the instructor, but is more complex for students. The use of tar in conjunction with turnin is demonstrated in one of the examples below.

Example 1: Using turnin after having done prep for the class

Usage: turnin file
Example: turnin hwk1.c

When you do prep for an OCE compatible class, one of the side-effects is that the courseid is stored in the shell environment variable PREPLABEL. Turnin is clever enough to take advantage of that, so if you have done prep for the class, you can run turnin without specifying the courseid. You simply identify the file you want to turnin as shown in the example above.

Example 2: Specifying the Course ID

Usage: turnin -c courseid file
Example: turnin -c cs161f hwk1.c

You can explicitly specify a Course ID by using the -c option. This method can be used regardless of whether you have run the prep command. It is appropriate for classes which are not on the OCE model.

Example 3: Using tar with turnin to handle multiple files

As mentioned above, if the material to be turned in for an assignment consists of multiple files or directories the recommended approach is to use the "bundle" mechanism (which must be set-up by the instructor). Another alternative is to use tar in conjunction with turnin. In this case tar packages the files and directories into a single file called a tar archive which turnin can handle.

Usage: tar-command | turnin -c courseid
Example: tar cvf - hw1.dir | turnin -c cs163w

In this example hw1.dir is a directory that contains multiple files and possibly sub-directories. Tar packages the whole hw1.dir directory hierarchy into a archive and that archive is passed via a Unix pipe to turnin. Notice that when turnin receives its input in this way (via stdin in Unix parlance) the courseid MUST be specified using the -c option. That is because turnin is prevented from asking the user to confirm a courseid determined from the prep PREPLABEL setting.

For more information about the tar program see "man tar".

Again, if the user has already turned in a file and is attempting to do so again, turnin will verify with the user that s/he wishes to overwrite the previous turnin (unless turnin is being run non-interactively -- as in the last example -- in which case the overwrite is automatic). In other words, turnin will accept only one file at a time and all subsequent turnins will overwrite previous ones. This is why "tar" is required for multi-file turnins.

If you still have questions or need additional assistance, please submit a ticket or call the ITS Service Desk at (858) 246-4357