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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, savannahckatz
Business professionals of america, and future business leaders of america – phi beta lambda are both open to business students at which levels? check all that apply. elementary school middle school high school college
Answers: 1
image
Computers and Technology, 22.06.2019 21:30, GamerGirl15
This graph compares the total cost of attending educational institutions in texas. the graph demonstrates that the cost at private and public technical schools greatly varies.
Answers: 2
image
Computers and Technology, 23.06.2019 00:00, dubouuu
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
image
Computers and Technology, 24.06.2019 05:30, kaylaamberd
Why is hard disk space important to an audio engineer? why are usb ports and firewire ports useful for an audio engineer? explain in 2-3 sentences. (3.0 points) here's a list of different audio software: ableton live apple inc.'s garageband apple inc.'s logic studio digidesign's pro tools propellerhead sofware's reason sony creative software's acid pro steinberg cubase steinberg nuendo choose one of the software programs listed above, and then go to that software program's web site. read about what the software program is used for, and then write 4-5 sentences about what you learned. (10.0 points) which type of software license is the most limiting? why? explain in 2-3 sentences. (3.0 points) when sending a midi channel voice message, how can you control the volume of the sound? explain in 2-3 sentences. (4.0 points)
Answers: 1
You know the right answer?
A telephone directory, called teledir. txt, maintains records in the form name: number where number...

Questions in other subjects:

Konu
Mathematics, 04.12.2020 14:00