Sei sulla pagina 1di 3

IT 222 : OPERATING SYSTEMS 2nd Sem SY 09-10

MIDTERM ACTIVITES

January 2010

For the next 3 weeks of the midterms, a $hell script is to be


accomplished. For each first meeting of the week, the script of the week
will be presented and its requirements discussed. Each script will be
given 2 meetings before its scheduled deadline. The deadline for each
scripting activity will be the last day of the week(Saturday). Scripts will be
checked during the first meeting of the week after the deadline. Each
scripting activity will be given a weight which is 7.5% of your midterm
laboratory grade.

WEEK 2 (2 meetings) :
Do(encode) the following projects li¿sted on your book: Project 6-15, 6-16,
6-17, 6-18, 6-19, 6-20, 7-9, 7-10, 7-11, 7-13, 7-14 and 7-19

WEEK 3 (2 meetings) :
Name of script : parkingcharge.sh

Create a script that computes for the total parking charge of a


customer. The following information are to be collected as inputs from
the standard input :
Plate number (format : 7 characters, the first 3 are characters from
ato z followed by a dash followed by a 3 digit number; i.e. : XXX-
123)
Time in (format : military time; i.e. 1500 => 3 PM)
Time out (format : military time; i.e. 1900 => 7 PM)
Type of vehicle : can either be the following characeters: L, U or H
which stands for Light vehicle, Utility vehicle or heavy vehicle
respectively.

The parking lot operates starting at 7 AM and closes at 11:30 PM.


The rates of the parking lot is as follows:
Standard parking fee (minimum of 2 hours) – 50 pesos
Succeeding hour or less in excess of 2 hours for :
Light vehicles – 5 pesos
Utility vehicles – 15 pesos
Heavy vehicles – 25 pesos
Futhermore, the maximum parking charge for the following vehicles
applies:
Light vehicles – 100 pesos
Utility vehicles – 150 pesos
Heavy vehicles – 250 pesos
The script should be able to validate whether the time in and time
out values are VALID inputs based on the value that is entered (time out
> time in). Other validations are not to be filtered by the script. The
output of the script is the parking charge of the vehicle and its details.

Sample run:

$ parkingcharge.sh

Please enter the plate number (i.e. : AAE-775) : XNY-123


Please enter the type of vehicle (L/U/H) : U
Please enter the time the vehicle entered the parking lot : 0845
Please enter the time the vehicle entered the parking lot : 1915

The vehicle with plate number XNY-123 was parked for 10 hours and 30
minutes. The parking charge for the vehicle is 150 pesos

Try again? : N

Sample run:

$ parkingcharge.sh

Please enter the plate number (i.e. : AAE-775) : GMA-111


Please enter the type of vehicle (L/U/H) : L
Please enter the time the vehicle entered the parking lot : 1245
Please enter the time the vehicle entered the parking lot : 1315

The vehicle with plate number XNY-123 was parked for 0 hours and 30
minutes. The parking charge for the vehicle is 50 pesos

Try again? : N

Note: Make sure the program keeps on repeating until the user enters ‘N’
to quit the program.

Hint : You can use the following commands/control structure to complete


your script : expr, if, test, for

WEEK 4 (2 meetings) :
Name of script : unique_users

Create a script that counts the total number of unique users who
are currently logged on to the system. The script should also show the
list of users who are logged on more than once and the number of times
they are logged on to the system.

Hint : You can use the following commands/control structure to complete


your script : finger/who/users, uniq, for
sample run:
$ unique_users

There are 15 unique users on the server

List of users who are logged on more than once

Login Name # of times logged

gepaul 3
susanc 2
it993452 2
it2003452 4
it2018909 3
it999012 2

Potrebbero piacerti anche