Problem

Now, you need to develop a way to enter new telephone number information into the corp_p...

Now, you need to develop a way to enter new telephone number information into the corp_phones file so that users can eventually build a complete data file of all employees.Notice that the phmenu script offers the option to add a phone record. To accomplish this, you develop the phoneadd script.

To create the phoneadd script for data entry:

1. Ensure you are in the source directory and then use the vi or Emacs editor to create the script phoneadd. Enter the following code:

2. Save the file and exit the editor. Notice the section that checks to ensure the last name is not blank. (See the comment.) This is included so that incomplete data isnot written to the file. In this code, the if statement checks to make certain that thelname variable is greater than an empty string (has contents). If lname does have a value (a string), the contents of all of the variables—lname, fname, midinit, deptno, jobtitle, datehired—are written to the phonefile variable (corp_phones) using the echo command.

3. Give the file execute permission by typing chmod a+x phoneadd and pressing Enter.

4. Run the script by typing ./phoneadd and pressing Enter.

5. Next, test the script by adding the following employees. (Press Enter after each separate field entry, for example, type 219-555-7175 and press Enter to go to the Last Name field.) See Figure 6-20.

6. Press Ctrl+c after you enter the data.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search