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 21:10
Dameas communication challenge is due to which factor
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 24.06.2019 11:20
Colby works as a shipping clerk for a major package delivery service. some of his daily tasks include tracking shipments and entering orders. which aspect of the information technology cluster would he most likely be trained in? a.networkingb.databasesc.hardwared.software
Answers: 2
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
You know the right answer?
A telephone directory, called teledir. txt, maintains records in the form name: number where number...
Questions
question
Mathematics, 12.10.2020 14:01
question
Mathematics, 12.10.2020 14:01
question
Social Studies, 12.10.2020 14:01
question
History, 12.10.2020 14:01
Questions on the website: 13722360