The first main step in the script is (Web hosting ratings)
The first main step in the script is to make a copy of the address book (line 49). If this step fails, you exit (line 50). If this step is successful, you make a list of all the lines in the address book that match the name specified by the user (line 55). If you cannot successfully make this file, you exit (line 56). Next you enter the delete loop (lines 60-89). For each line that matches the name provided by the user you print a formatted version of the line (lines 66-69). Notice that you are using the same awk statement from the showperson script. For each matching line, you ask the user whether the entry should be deleted (line 73). If the user agrees (line 74), you do the following: 1. Try to delete the line from the copy of the address book. Store the modified version in a different file (line 79). 2. Replace the copy of the address book with the modified copy (line 84). If either of these operations fail, you exit (lines 80 and 85). After the deletes are finished, you make a backup of the original address book (line 93). Then you replace the address book with the fully edited version (line 98). Again you exit if either operation fails (lines 94 and 99). Finally you clean up and exit. Here is an example of this script in action: $ ./delperson Sriranga Name: Sriranga Veeraraghavan Email: ranga@soda.berkeley.edu Address: 1136 Wunderlich Dr. San Jose CA Phone: 408-444-4444 Delete this entry (y/n)? [n] y Here I replied yes to the question. You can confirm that the delete worked as follows: $ ./showperson Sriranga $ Because there is no output from showperson, this entry has been deleted. Sams Teach Yourself Shell Programming in 24 Hours Contents Index Hour 22: Problem Solving with Shell Scripts Previous Chapter Next Chapter Sections in this Chapter: Moving Directories Questions Maintaining an Address Book Terms Summary Previous Section Next Section Copyright Macmillan Computer Publishing. All rights reserved.
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.