EEL 358 - Operating Systems
Fall 2006
Indian Institute of Technology Delhi, New Delhi



Assignment 1

UNIX Shell Programming - Scripting with BASH

The objective of this assignment is to examine your familiarity in Unix shell scripting using the bash shell.

Create a script called uinfo that will provide information about the users of the system.  By default, uinfo, invoked with no arguments, will display information about users who invoked the program, or the current user. Your script should support the following options.

        -a                    Show information about all users of the system

        -t                    Show the total login time for each user to be shown

        -g string           Show the information about members of all groups with names that contain string

        -u string           Show the information about users with login names that contain string

        -s login|name|group    Sorts the output based on the login name, full name, or group name

                                       (requires -g, -u, or -a)

        -h or -?            Show program options and their descriptions

        -o filename        Save the output to a file called filename

        -f number          Show only users whose uid is greater than the indicated number   

Example Default Output: (current user is ajaykr)

Login Name    :    ajaykr

Full Name     :    Ajay Kumar

User ID       :    351

Group         :    fac

Directory     :    /home/ajaykr

Shell         :    /bin/bash

Last Login    :    Fri  Aug 11  07:52  (IST)  on  pts/1  from  10:200:5:56

        ------ Additional output if -t option is used ------

        Total Time    :    11 hours 10 minutes

Assumptions

    1. Users do not login to the system for more than a day.

    2. Options may be combined (e.g. uinfo -t -g ee2006 -u arun -s name).

    3. The script must display error messages in the event of error (e.g. uinfo -u xyz (print an error message illustrating that there is no user name that has a substring xyz).

    4. For users who have never logged in to the system, the script must display Never logged-in message.


Points Distribution  [Maximum 20]

1. Implementing help (-h or -?) ® 5%
2. For output to file (-o) ® 5%
3. Implementing sorting (-s) ® 8%

4. Implementing filtering based on uid (-f) ® 8%

5. Implementing total time option (-t) ® 10%

6. Implementation for list of users (-u) ® 12%

7. Implementation for list of users of each group (-g) ® 16%

8. Implementing no option/default output ® 16%

9. Implementation of support for multiple command line options ® 20%

10. Clarity, Formatting and General Layout ® Up to -5 if not followed
11. Originality ® Both copier and originator gets ZERO
12. Late Policy
® 20% reduction, allows ONLY one day delay.

Submission

Please submit a tar file on-line containing the following:

The tar file can be uploaded in the assignment # 1 using this link. Please make sure that you upload the assignment only once. In case of multiple submission ONLY first submission will be used for grading.

Deadline

The submission deadline for the assignment # 1 is 22 August 2006 [23:59 Hrs].

Questions

If you have any further questions relating to this assignment, you may contact the TA, Mr. Jayant Kumar Gandhi [2005EET2906].