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, 23.06.2019 07:30
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
question
Computers and Technology, 24.06.2019 13:00
In a heat transfer course, we can derive the equation for the temperature distribution in a flat rectangular plate. in this example, we will look at a plate at steadystate with three sides being held at t1, and one side held at t2. the temperature for any location on the plate, t(x,y), can be calculated by where create a function (prob3_5) that will take inputs of vectors x and y in feet, scalar n, scalars l and w in feet and scalars t1 and t2 in degrees fahrenheit. it will output a matrix t which is the temperature of each x and y locations. t will have the number of columns equal to the number of elements in x and rows equal to the number of elements in y. though this can be done without loops (perhaps more efficiently), your program must use a nested loop.
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
You know the right answer?
A telephone directory, called teledir. txt, maintains records in the form name: number where number...
Questions
question
English, 16.09.2019 19:30
Questions on the website: 13722363