CS476/576

Assignment #1

Due Midnight, Wednesday Oct 7, 2009


Write a shell script (in any shell you like) with the following descriptions:

NAME


umail -   Unix Accounts Mailing Lists

SYNOPSIS

umail    [groups]

DESCRIPTION

This shell script is used to generate several up-to-date UNIX accounts mailing lists.

At ODU, the CS department group file (ypcat group) lists the various unix groups names

and their assigned group numbers.

  

For example, here is a sample  of this file:

 

student:*:21:jroberts,vanet

faculty:*:13:ajay,ibl,gpd,jrcrouch,grosch,mukka,olariu,cmo,pothen,price,toida,wilson,zeil,zubair,mln,brunelle,maly,rgupta,dkaneko

grad:*:22:jjohn

staff:*:10:robin_c,jroberts,igullett,tihomir,joseph,kevin,max,minhao

guest:*:31:

 

Each UNIX user has an entry in the password file (ypcat passwd).

For example, here is a sample of this file that contains one  member for each of  above sample groups:

 

thristov:JPSijeRq4jB82:783:21:tihomir hristov:/home/thristov:/usr/local/bin/tcsh

wahab:stg/i.0xxJ1zU:51:13:Hussein Abdel-Wahab:/home/wahab:/usr/local/bin/tcsh

hshi:h8fj6/06qHSmg:189:22:Hui Shi:/home/hshi:/usr/local/bin/tcsh

robin_c:l5zLZCKUTmFNw:15:10:Chris Robinson:/home/robin_c:/bin/bash

tisenhou://PGVHc7vi9lI:1470:31:tom isenhour:/home/tisenhou:/usr/local/bin/tcsh

 

 

If there is no arguments, your shell script should use the information stored in these two files and produce the following 10 files:

 

·        studentEmails, studentNames

·        facultyEmails, facultyNames

·        gradEmails, gradNames

·        staffEmails, staffNames

·        guestEmails, guestNames

 

The Emails files contain the login name, one line per  user..

The Names files contain the login name and the user full name separated by “:”, one line per user.

For example:


facultyEmails:

wahab

maly

cmo

….

 

facultyNames:

.....

wahab:Hussein Abdel-Wahab

maly:Kurt Maly

cmo:Mike Overstreet

……..


 

If there are arguments, your shell script should produce the files corresponding to the specified groups arguments.

For example:

% umail   office   faculty

It will produce the files for only these two groups.