|
Linux help
Use the following information in your script.
Products & services Charges(RM)
Engine oil 90
Engine oil filter 30
Gear box oil 80
Power steering fluid 30
Tyres alignment 100
Tyre balancing 10
Workmanship 50
When the script starts, it should initialise variable LOGIN with the value passed in as parameter,
then initialise variable WP to the directory (RECP) to store receipts, and variable LOGP to the
directory (LOGS) to store log files.
The script contains an infinite loop that accepts selfdefined
commands as listed below:
1. genp
2. reprint
3. log
4. price
5. bkup
6. !help
7. quit
1. genp
Generates receipt and then displays it on screen.
User should input quantity of all products. Initialise the quantity of each product at the
beginning of script.
Sample format of receipt:
______________________________________________
Official Receipt
Date:
Products & services Qty Subtotal
Engine oil 1 90
Engine oil filter 1 30
Gear box oil
Power steering fluid 1 30
Tyres alignment
Tyre balancing
Workmanship 1 50
Grand total: 200
______________________________________________
Format of file name: RCDDMMMYYN
N is a counter, starts with value 1, incremented by 1 for each receipt.
Examples: RC11Mar101,
RC11Mar102,
RC11Mar103
Command date +%d%b%y will print the day, month and year, example: 11Mar10
Write a record to a log file (logDDMMMYY)
whenever receipt is generated.
Sample records:
Receipt RC11Mar101
issued. user. Wed Mar 11 10:09:17 MYT 2010
Receipt RC11Mar102
issued. user. Wed Mar 11 10:34:35 MYT 2010
Create a a log file (takenDDMMMYY)
to store records for all products used.
Sample records:
Receipt: RC11Mar101,
user
1 Engine oil. Wed Mar 11 10:09:17 MYT 2010
1 Engine oil filter. Wed Mar 11 10:09:17 MYT 2010
Receipt: RC11Mar102,
user
1 Gearbox oil. Wed Mar 11 10:34:47 MYT 2010
If the quantity of a product is less than 10, write a record to a log file (urgentDDMMMYY).
Example:
Engine oil. Wed Mar 11 10:34:47 MYT 2010
Power steering fluid. Wed Mar 11 10:34:47 MYT 2010
2. reprint
List all receipts and allow user to reprint (to screen) the selected receipt.
3. log
List all log files and allow user to view selected log file.
4. price
Update the charges of selected products or services.
5. bkup
Backup RECP or LOGS directory to a user specified location.
6. !help
Display all commands available.
7. quit
Exit the program.
Design
|