This is from a little course I prepared Linux exercises for Purpose: Practice using functions, arrays and other

shell script features Your task is to write a checkbook program. Make sure you read the following directions carefully and implement the script according to these specifications. Failure to do so will cost you points. Script name: checkbook.sh Positional parameters: account Example call: ./checkbook.sh myacct

Part 1) Below is a sample xml record which your program must be able to parse. Store the records into an array and write a function to print out each record. Pretty print the records, that is, have a column names at the top. You program must support an unsorted file that could have any number of records. Here is a simple xml file with only one record: <array> <dict> <key>Id</key> <string>1</string> <key>Type</key> <string>credit</string> <key>Date</key> <string>10108</string> <key>Details</string> <string>New Account</string> <key>Amount</key> <string>500.00</string> <key>Rec</key> <string>1</key> </array> It has 6 attributes: Id, Type, Date, Details, Amount, and Rec. It has 1 value for each attribute: 1, credit, 10108, New Account, 500.00, and 1. You can assume that each tag is open and completed on a single line and that each key is followed immediately by its value.

For instance, the tag <key> is represented by <key>Amount</key> and its value is <string>500.00</string> . Dates are formatted this way: mmddyy (mm should be one character if it's before 1 digit) Tools recommended for this part: grep, cut, and loops

Part 2)
Please visit : http://jamesdocs.blogspot.com for more

Sign up to vote on this title
UsefulNot useful