CS 1206: Assignment 6

Due Friday, April 10, 1998 by 5pm

100 Points




Writing A Shell Script

Your assignment is to write a simple shell script called whereami. When invoked, this script will print out the user name of the current user, the name of the current machine, the full path name of the current working directory, the current time, and a listing of the contents of the current directory. This is followed by a blank line, then a count of the number of ordinary files, executable files, directories, and links in the current directory. Output from whereami should follow this example:

You are          : ltw
You are on       : cayuga.cs.vt.edu
Current directory: /f/ltw/classes
The time is      : Fri Oct 31 10:21:16 EST 1997
Current directory contents:
1206-old/       bin/            invd2.dat       skel/           working/
A5.html         configs/        invd3.dat       sum3/           zlink@
Bugs.txt        gnuemacs-lib/   invd4.dat       tools
Mail/           invd1.dat       nsmail/         whereami*

7 ordinary,  1 executable,  9 directories,  1 links.

Remember that your shell script must start with a proper "bang line":

    #!/usr/local/bin/ksh
It should also end with a proper return statement.

Sources For Information

Your shell script is free to access any shell or environment variables, and call any commands provided on the system. Some shell variables you might wish to explore include:

Some commands that may also be of use are (see their respective manual pages):

Submitting Your Answers

You are to hand in your assignment by sending an email message to the address cs1206@ei.cs.vt.edu. To receive credit, your mail message must be received by this account by the time and date listed above. It is your responsibility to successfully submit your assignment via email (remember that you will receive an auto-reply by the system when your message has been received successfully). Also, send yourself a copy for future reference. The messsage must be a plain ASCII text file, with no attachments, and in exactly the format defined below. Do not insert any extra notes or explanations.

The body of your message must be a plain ASCII text file that contains the following:

Note that you will lose points on your homework assignment for failing to follow these instructions--i.e., using an incorrect subject, failing to include your name, or failing to include any of the other required elements listed above. Also, remember that no late assignments are accepted.




Layne T. Watson <ltw@cs.vt.edu>
Last modified: Wed Jan 28 21:12:21 EST 1998