Page 1 of 1

Write a bash script that is menu driven to add/remove/update/search for a student record stored in a text file (simple D

Posted: Sat May 14, 2022 7:14 pm
by answerhappygod
Write a bash script that is menu driven to
add/remove/update/search for a student record stored in a text file
(simple DB file ...call it StudentData.txt). The file has the
following fields separated by ":' delimiter.
firstName LastName : PhoneNumber : Email
example: Bob Smith: 408-500-3000: [email protected]
assume the file is stored in the current working directory. If
the file does not exist on an "add" request, the script will create
that file.
when an "add" is requested, check if a record with that name
already exists. If all info are identical (name, phone, email) the
script should say user already exist and present the menu (options)
again. if the phone or email are different, prompt the user
that the record exists but with different phone and/or email and
ask if the user wants to update the existing record or not. Act
upon the user input (yes/no).
when trying to remove a record...print the a message if the
record is found and ask for confirmation to delete/remove the
record. if the record asked to be removed is not found, print
out a message stating that and display the menu options again.
For the search(view) option, the script will display the
record(s) on the screen and then display the option menu again.
Use functions when writing your script (example AddRecord (),
RemoveRecord (), UpdateRecord (), ViewRecord (). When
the Exit option is chosen the script terminates.
example of the script menu:
what you want to do (choose 1-5) according to the following
menu:
1) Add a new record to the database file
2) Remove a record from the database file
3) Update a record in the database file
4) View a record from the database file
5) Exit