

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Note: Submit before midnight of Mar 31 to email: [email protected] with Subject Project 2.
Write a sh or bash script to manage your contact book. The script should allow the user to add a contact to the contact book, remove a contact by specifying the contact's name, display all contacts (sorted by LastName, FirstName, PhoneNumber, or Email), and search a contact's information by name. The script should be menu‐based with the following options:
Main Menu: (a) Add a contact (r) Remove a contact (s) Search a contact (d) Display all contacts’ information (e) Exit Your choice?
Add Submenu: Please input First Name: Tom Please input Last Name: Jackson Please input Phone Number: 1 ‐ 404 ‐ 5555555 Please input Address: 34 peachtree st.,Atlanta,ga, Please input Email: [email protected] A new contact is added into your contact book.
Remove Submenu: Please input First Name: Tom Please input Last Name: Jackson Tom Jackson is removed from your contact book.
Search Submenu: Please input the contact’s First or Last name: Tom First Name: Tom Last Name: Jackson Phone Number: 1 ‐ 404 ‐ 5555555 Address: 34 peachtree st.,Atlanta,ga, Email: [email protected]
First Name: Tom Last Name: Jackson Jr. Phone Number: 1 ‐ 770 ‐ 5555555 Address: 34 peachtree st.,Atlanta,ga, Email: [email protected]
Display Submenu: (1) Display all (2) Display all sorted by Last Name (3) Display all sorted by First Name (4) Display all sorted by Phone Number (5) Display all sorted by Email (6) Return to Main Menu Your choice? All contacts sorted by First Name First Name: Firstname Last Name: Lastname Phone Number: 1‐ 555 ‐ 5555555 Address: Apt D‐3, 34 peachtree st., Atlanta, GA, 30303 Email: [email protected]
First Name: Tom Last Name: Jackson Phone Number: 1 ‐ 404 ‐ 5555555 Address: 34 peachtree st.,Atlanta,ga, Email: [email protected]
First Name: Tom Last Name: Jackson Jr. Phone Number: 1 ‐ 770 ‐ 5555555 Address: 34 peachtree st.,Atlanta,ga, Email: [email protected]
Note: For all submenus, return to the main menu after an operation is done.
Each contact entry should consist of FirstName, LastName, PhoneNumber, Address, and Email. All contact entries must be kept in a text file, called contacts.txt in the user’s home directory with the following format (“:” is the separator.): Firstname:Lastname:1‐ 555 ‐5555555:Apt D‐3, 34 peachtree st., Atlanta, GA, 30303:[email protected] Tom:Jackson:1‐ 404 ‐5555555:34 peachtree st.,Atlanta,ga,30303:[email protected] Tom:Jackson Jr.:1‐ 770 ‐5555555:34 peachtree st.,Atlanta,ga,30303:[email protected]