Assignment 1 - Unix - Comp 206
Assignment 1 - Unix - Comp 206
COMP-206
Software Systems
Due: September 29, 2008 on WEB CT at 23:55
Operating Systems
This assignment explores the Unix operating system and how its subsystems are interrelated. We will explore three areas of this system: the command line subsystem, the
batch file subsystem and the operating system shell.
Within Source create the directories: BATCH, C, HTML, CGI, PERL and
PYTHON.
As the course progresses we will create our programs in the Batch, C, HTML, CGI,
Python and PERL directories. Our database of products will be located in the DATA
directory, and all the executables will be saved in the RUNTIME directory. This
directory space is considered to be a part of our development environment. Later, we will
have to put this on the web (for real) and this will be done in our deployment
environment, PUBLIC_HTML (but that will come later).
The next thing we need to decide is the type of products we would like to sell. This I will
leave up to you, but we will need to create some databases. Since this is not a database
course and since many of you have probably not programmed databases, our database
jvybihal
Page 1
9/15/2008
McGill University
will be a "flat file" database (i.e. a text file). You MUST use VI to create two of our
primary databases (there will be more databases later):
As the names imply the inventory database will record the products your store sells and
how many are in stock. The member database contains the names of all the valid users of
your store (like eBay).
A flat file database is organized around records and fields. A field is each piece or type of
information stored: like user ID or user password. A record is a group or set of fields. It
contains all the information about a single user or product saved in your database. In a
flat file, the record is one line and commas separate fields. For example, the member's
database could look something like this:
1234, abcd, Joseph Vybihal, 1, 500
9987, ddee, Bill Smith, 0, 20000
1072, ABCdef, Sam Smiley, 0, 100
Each row contains all the information about one user. This is called a record. A comma
separates each piece of information about the user in that row: ID first, then password,
followed by user name, etc. Pressing the carriage return terminates the record. There is
also a carriage return on the last record. This leaves us with a blank line at the end of the
file. This is okay.
For question 1 do:
Create the development environment directory structure (record what you did in a
text file called STRUCT.TXT). I cannot confirm if you actually created the
directory structure using the command-line. You could have done it using
Windows and then pretended. To overcome this, I am asking you to type out the
commands you would use, in-order in this text file, as if you where at the
command-line actually doing it (You should ACTUALLY do it but the TA will
not verify this, only the STRUCT.TXT file you upload to WEB CT).
Using VI, create the two databases INVENTORY.TXT and MEMBERS.TXT and
populate them with data (build and save them in the directory DATA). Then send
these text files to WEB CT. Again I cannot confirm if you actually used VI but I
suggest you do, so that you can be used to it for exam questions.
jvybihal
Page 2
9/15/2008
McGill University
Note: To answer this question you may have to do readings. Check the OS manual that
comes with your computer, the Internet and the MAN command in Unix or HELP in
DOS.
Upload to Web CT a PDF or TXT file containing you answer. Name this file SHELL.txt
or SHELL.pdf.
This assignment question wants you to customize the Unix login set-up script.
As discussed in class there are a few login script files in Unix depending on the shell you
are using. Identify the default shell that is in operation during your login and modify its
login script in the following ways:
jvybihal
Page 3
9/15/2008
McGill University
Your login script can process this in any order you like.
jvybihal
Page 4
9/15/2008
McGill University
Automatically create a text file called INVALID.TXT that is initialized with the
words: PLEASE ENTER INVALID USERS, using the commands ECHO and
redirection
Open the file INVALID.TXT with VI. The user will enter names of users that are
not permitted to become members of your store. The user will have to terminate
VI manually before the batch file continues execution.
Nothing
Nothing
Use MORE to display SORTED.TXT so that the user can visually verify if there
are duplicate users
Use MORE again to display FOUND.TXT to see if any unauthorized users have
registered.
Cleanup Job 3:
Delete all the files in TESTBED and the directory TESTBED itself.
WHAT TO HAND IN
Everything must be submitted to WEB CT Vista before the due date. Remember that
WEB CT permits you to hand in up to two days late but there will be a penalty of 5%
each day. After that, the WEB CT submission box will close. There is a PROBLEM box
that you can submit to on WEB CT. But I will not be grading this box. You must email
me with a very very very good reason to why something in the problem box should be
graded. Please hand in the following:
jvybihal
Page 5
9/15/2008
McGill University
For question 2: SHELL.TXT or SHELL.PDF that will contain your essay about
Unix and Windows shell comparisons (optionally Unix/Mac). The login script
that you are using.
jvybihal
Page 6
9/15/2008