subject

A telephone directory, called teledir. txt, maintains records in the form name: number where number is of the form nnn-nnn- for example; Chelsey: 480-727-1007
Devise a shell script that accepts one or two arguments that could be:

the name or number. If it exists in the directory, then the line should be displayed.
both. The entry is displayed if it exists and is added if it doesn’t exist in the file.
You can follow the steps below (not the only way):

Assign the pathname to the file teledir. txt to a variable, say, TELEDIR. For example, if it is in your home directory, you’ll need to assign $HOME/teledir. txt to the variable TELEDIR
Check that one or two arguments are supplied using $# and the case…esac construct.
If one or two arguments are supplied, do nothing
otherwise, Indicate that the usage must be in the form scriptname [name number], then exit
Using the $# and the case…esac construct,
If one argument is supplied,
If it starts with a digit, search it in the file. If it doesn’t exist, echo that "Number doesn’t exist"
If it starts with a letter (lower or uppercase), search it in the file. If it doesn’t exist, echo that "Name doesn’t exist"
If two arguments are supplied, set the search_pattern to be "name: number", and search it in the file.
If it is not found, echo "Adding entry", and append to the file/variable.
Otherwise, echo that "Entry exists"

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:00
What role do chromosomes play in inheritance?
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
Jamie has to enter the names, employee id’s, and income of a group of employees into a worksheet. which option will jamie use to describe the data
Answers: 3
question
Computers and Technology, 24.06.2019 18:30
How does the use of e-mail benefit business communications? it can be sent at any time. it is faster than regular mail. it improves writing skills. it is less expensive than using a courier. it reduces the need for proofreading.
Answers: 1
question
Computers and Technology, 25.06.2019 04:10
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
You know the right answer?
A telephone directory, called teledir. txt, maintains records in the form name: number where number...
Questions
question
Mathematics, 31.03.2021 02:00
question
English, 31.03.2021 02:00
question
Mathematics, 31.03.2021 02:00
question
History, 31.03.2021 02:00
question
Computers and Technology, 31.03.2021 02:00
Questions on the website: 13722366