Problem

The while statement is another example of looping logic in addition to the for statement...

The while statement is another example of looping logic in addition to the for statement. Inthis project, you first create a shell program that contains a basic while statement. Next, you create a shell program as might be used for an onscreen data input form to store name and address information in a flat data file.

To use a basic while statement in a shell script:

1. Use the vi or Emacs editor to create a shell script called colors.

2. Enter the following lines of code:

3. Save the file and exit the editor.

4. Give the file execute permission, and test it.Type clear and press Enter to clear the screen.

Another example of the while statement is a data-entry form.

To create a while loop that serves as a data-entry form:

1. Use vi or Emacs to create a script file, nameaddr.

2. Type these lines into the file:

3. Save the file and exit the editor.

4. Give the file execute permission, and test it. As you test the script, enter several names and addresses. When you finish, answer n (for no) when the script asks you, “Continue? (y)es or (n)o.” (See Figure 6-13.) Type clear and press Enter to clear the screen for the next project.

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