Question
UNIX Shell Programming For this exercise you need to manipulate your personal contacts file to find out people whose birthday is today. Hint: consider using
UNIX Shell Programming
For this exercise you need to manipulate your personal contacts file to find out people whose birthday is today. Hint: consider using grep, sort
You are required to write a script titled searchcontacts.sh that will do the following:
- The script is going to take as parameters the user's full name: first name, last name.
- Greet the user by his or her first name.
- Tell the user the day of the week, and the current time in nonmilitary time. The output should resemble the following (See man pages for the time/date commands):
Today is Tuesday and the current time is 04:07:38 PM.
- Show the contacts whose birthday is today (hint: look at man pages for date options, then use pipes and grep):
These contacts are having a birthday today:
Xxx .
- Ask the user for a friends last name (you may add this as a menu option)
Enter a contact last name to search in file:
- Search in the file mycontacts.txt (format is shown below) for that last name and print out to the screen the line with the information about that person
- If not found,
- Count the number of lines and tell the user that in the screen
- Sort the file (by name) and print out to the Console the contents of the mycontacts.txt file (hint: remember commands for sorting)
- Tell the user (use first name) good-bye and the current hour. Exit the script.
Mycontacts.txt format:
The information is in one line and separated by spaces,
1. friend's full name: first, last.
2. his/her birth date (dd-mm)
3. his/her phone number (xxx-yyy-yyyy)
4. his/her email (name@domain.xyz)
e.g. John Smith 02-05 213-662-3577 smith@example.com
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started