The shar and turnin Utilities What are shar and turnin?

advertisement

The shar and turnin Utilities

What are shar and turnin?

The Linux utility program named shar , an abbreviation for

“shell archive”, can be used to create a single file that contains a subdirectory and all files that are in that subdirectory. This allows you to send a single “ shar file ” across a network to another location where the entire directory structure can be recovered.

The turnin utility was developed at UNF and is what you use to actually send the “shar file” to your instructor. The

“shar file” will be placed in one of your instructor’s subdirectories and your instructor can “ unshar ” that file to recover the files that you created as part of your programming assignment.

How to Turn in Your Assignments:

0. Assumption: You have already: Used pico or vi to create a source code file, xxxx.java

or some other kind of file xxxx.txt

or whatever you’d like to call it.

You have saved the file you created. Assume you called the file notes.txt

and initially created it by issuing the command

osprey $ pico notes.txt <ret>

……… <entered text>

<control-x> (hold control key and enter x)

1. From your home directory

(Note: cd { c hange d irectory} will always get you ‘home.’)

You will then see: osprey $

Note: You can enter pwd <ret> ( p rint w orking d irectory) to find out what your current directory is. If I enter pwd when I am in my home directory, I will see osprey $ pwd

/home/p/phigbee

Also note: My phigbee account is set up so that I always see my current working directory without entering pwd.

Now: a k e a sub dir ectory named cop2551 osprey $ mkdir cop2551 c hange to this sub d irectory: osprey $ cd cop2551 <ret> issue a pwd : $ pwd <ret> ( shows you where you ‘are’)

I would see: /home/p/phigbee/cop2551

You would see a path that includes your userid .

2 . In this subdirectory, make a subdirectory with your userid as its name (I will use my userid in examples).

osprey $ mkdir phigbee <ret>

3. c o p y the *.java

source code ( * can be any name) or whatever other type of text file you want to turn in into the subdirectory you just made .

osprey $ cp notes.txt phigbee <ret>

If you want to see if the file, notes.txt

is really moved into the subdirectory, phigbee (use your userid), do: osprey $ osprey $ cd phigbee <ret> ls ( l i s ts the subdirectory contents)

You should see the notes.txt

file listed in phigbee.

To return to cop2551 (one level up) enter: osprey $ cd .. <ret> (two dots indicates go up one level) osprey $ pwd <ret> and you should see

/home/p/phigbee/cop2551 (but with your userid)

4. From the directory, cop2551 , where you created the subdirectory having your userid as its name, redirect the output of shar to a file that has your userid name and a

.shr

extension.

shar your_userid > your_userid.shr

that is, osprey $ shar your_userid > your_userid.shr

You should see: shar: Saving your_userid/notes.text (text) where " your_userid " is your actual Osprey userid , and the

“>” means to ‘ redirect ’ the output of shar to

“ your_userid.shr

”. This ‘ shars ’ your subdirectory named your_userid and all of its contents into a single shar file named your_userid.shr

.

5. To be sure you have done this correctly, make

another subdirectory with any name, for example osprey $ mkdir testdir <ret>

and copy the file named your_userid.shr

into that

subdirectory.

osprey $ cp phigbee.shr testdir <ret>

6. Change to that new subdirectory in cop2551 and look at its contents…

$ osprey cd testdir <ret>

$ osprey ls <ret>

You should see only a single file: your_userid.shr

7. Now, ‘ unshar ’ your file. from testdir issue the unshar command: osprey $ unshar your_userid.shr or, for me: osprey $ unshar phigbee.shr <ret>

For me, I should see:

/home/p/phigbee/cop2551/testdir/phigbee.shr:

x – creating lock directory

x – creating directory phigbee

x – extracting phigbee/notes.text (text)

osprey $

You should see a subdirectory created with the name of your userid and your source code should be in that subdirectory.

8. Provided you were able to create the shar directory and then recover the directory that has the name of your userid along with your source code, you are ready to do

"turnin".

So, go up one level: osprey $

This would put me at

In the directory where the file your_userid.shr is located (cop2551), enter cd .. <ret>

/home/p/phigbee/cop2551

turnin your_userid.shr higbee.cop2551_xx.p1

if you are turning in the program #1 or

turnin your_userid.shr higbee.cop2551_xx.h1

if you are turning in the first homework.

( NOTE _xx represents the underscore character followed by your two-digit section number which is 43 this term)

For example, using my userid I might enter:

osprey $ turnin phigbee.shr higbee.cop2551_43.h1 <ret>

Each assignment you turn in will have a different "assignment code".

The turnin utility should tell you that the file has

been successfully turned in. It ends up in one of my

subdirectories.

You should see something like:

Turning in file your_userid.shr for assignment

higbee.cop2551_xx.h1 for user your_userid. where xx is your section number and h1 or p1 or whatever indicates the assignment you are turning in .

Note: If you turn in a project multiple times, only the last turnin is kept. Once class begins on the

due date, turnin will not accept any more projects.

The receiving file has a time-block on it – the start of class…

If you have any problem, see me and I will demonstrate the procedure. I also plan demonstrations during our first class sessions. This is reasonably easy after you have done it the first time. Don't hesitate to ask for help. You can send me email at phigbee@unf.edu

.

Note: Take a look at the manual page for turnin by entering

man turnin

at the Linux $ prompt. It will tell you how to find out when a project is due and to see if your project was turned in successfully.

Download