Question: Write a bash script named MyWallet.sh managing a simple bill system. Every bill corresponds to a record (line) in a text file named bills.txt (if

Write a bash script named MyWallet.sh managing a simple bill system. Every bill corresponds to a record (line) in a text file named bills.txt (if this file is inexistent, create it). Each record consists of 7 fields (record ID, category, detail, amount, year, month, day) separate by percent sign (%).

e.g.:

1%restaurant%subway%5.58%2016%2%11

2%gas station%shell%20.15%2016%3%1

-No percent sign (%) in each field.

-The record ID is unique, and generated by this system automatically. (when create a new record, the ID should be the last records ID number + 1.)

-The category, detail, and amount are input by user.

-The date (year, month,day) is generated by this system by using the record creation time. (Year: date +%Y ; Month: date +%m ; Day: date +%d)

-MyWallet.sh should provide a menu with following functionalities that users can choose from at the top level menu:

1. Enter a to add a new bill Ask for category

Ask for detail

Ask for amount

Generate record ID and date

Add this new record into bills.txt file

At the end, print New bill added successfully

Provide option t for Try again and b for Back to main menu

2.Enter d to remove a bill

Ask for record ID

Examine if this record exits. if no, print a message No such record!, otherwise, display this record and remove it from bills.txt file.

Provide option t for Try again and b for Back to main menu

3.Enter c to count amount

Ask for time range (start date(year, month,day) and end date(year,month,day))

Count and display amount of all bills in this time period.

Provide option t for Try again and b for Back to main menu

4. Enter v to view bills

Ask for search type (by category, by time, or by record ID)

Ask for category if by category Ask for time range if by time

Ask record ID if by record ID

Display all bills satisfied the condition

Provide option t for Try again and b for Back to main menu

5.Enter q to quit this system

Terminate this system

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!