Professional Documents
Culture Documents
Create A Phone Directory Using Shell Script With Various Operations in It
Create A Phone Directory Using Shell Script With Various Operations in It
Submitted by
N.JAHNAVI 22R01A0446
2022-2023
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
CERTIFICATE
This to certify that a Micro Project entitled with “CREATE A PHONE DIRECTORY
USING SHELL SCRIPT WITH VARIOUS OPERATIONS IN IT” is being
Submitted by
N.JAHNAVI 22R01A0446
In partial fulfilment of the requirement for award of the “Scripting Languages Lab” of II B.
Tech I semester in ECE to the CMRIT, Hyderabad is a record of a bonafide work carried out
under our guidance and supervision.
(Head Of Department)
ACKNOWLEDGEMENT
We are extremely grateful to Dr. M. Janga Reddy, Director, Dr. B. Satya Narayana, principal
and Dr.K.Nirangan Reddy, Head of Department, Dept of computer Science and Engineering,
CMR Institute of their inspiration and valuable guidance during entire duration.
We express our thanks to all staff members and friends for all the help and coordination
extended in bringing out this project successfully in time.
Finally, we are very much thankful to our parents and relatives who guided directly or
indirectly for successful completion of the project.
N.JAHNAVI 22R01A0446
ABSTRACT:
Phone Directory Shell Script
In the realm of shell scripting, the creation of a phone directory script offers a
practical and efficient solution for managing contact information. This project
introduces a shell script designed to perform various operations on a phone
directory, providing users with a streamlined interface to add, search, display,
and delete contacts.
INTRODUCTION:
The Phone Directory Shell Script is a simple command-line tool designed to
manage a phone directory. It allows users to perform basic operations such as
adding new contacts, searching for existing contacts, displaying the entire
directory, deleting contacts, and exiting the application.
Key Features:
User-Friendly Interface:
The script presents a clear menu interface for users to interact with various
operations.
Data Persistence:
Upon initialization, the script checks for the existence of the directory file,
creating it if not present.
Operations:
Add Contact:
Users can add new contacts by providing the name and phone number.
The script performs a case-insensitive search and displays the contact details if
found.
The script allows users to view the entire phone directory, presenting a list of all
contacts.
Delete Contact:
The script removes the contact entry from the phone directory file.
Exit:
A graceful exit option allows users to conclude their interaction with the phone
directory script.
Usage:
Objective:
phone_file="phone_directory.txt"
if [ ! -e $phone_file ]; then
touch $phone_file
fi
add_contact() {
search_contact() {
}
# Function to display all contacts
display_contacts() {
cat $phone_file
delete_contact() {
while true; do
1) add_contact ;;
2) search_contact ;;
3) display_contacts ;;
4) delete_contact ;;
esac
clear
done
ACTUAL OUTPUT:
Make the script executable:
chmod +x phone_directory.sh
./phone_directory.sh
4. Delete a contact
5. Exit
Enter your choice (1-5): 1
4. Delete a contact
5. Exit
Phone Directory:
4. Delete a contact
5. Exit
4. Delete a contact
5. Exit
4. Delete a contact
5. Exit
Phone Directory:
4. Delete a contact
5. Exit
CONCLUSION:
This phone directory shell script provides a practical solution for managing
contact information through a user-friendly interface. Its functionality,
combined with data persistence, offers a valuable tool for individuals seeking an
efficient and accessible method to organize and manipulate phone contacts.
Users can easily adapt and extend the script to suit specific needs, making it a
versatile and customizable solution in the realm of shell scripting.
REFERENCES:
Bash Reference Manual "Unix and Linux System Administration
Handbook" by Evi Nemeth, Garth Snyder, Trent R. Hein, and Ben
Whaley.
"Learning the bash Shell" by Cameron Newham and Bill Rosenblatt.