Problem

In this project, you create a for loop and use the brackets wildcard format to loop thro...

In this project, you create a for loop and use the brackets wildcard format to loop through each element in a for statement, which consists of simulated book chapters. You first create the files chap1 through chap4. Next, you create a script that displays the contents of each file using the more command.

To create the sample chapter file and use wildcards in a for loop:

1. Type cat > chap1 and press Enter.

2. Type This is chapter 1 and press Enter.

3. Type Ctrl+d. The file chap1 is created.

4. Type cat > chap2 and press Enter.

5. Type This is chapter 2 and press Enter.

6. Type Ctrl+d. The file chap2 is created.

7. Type cat > chap3 and press Enter.

8. Type This is chapter 3 and press Enter.

9. Type Ctrl+d. The file chap3 is created.

10. Type cat > chap4 and press Enter.

11. Type This is chapter 4 and press Enter.

12. Type Ctrl+d. The file chap4 is created.

13. Use the vi or Emacs editor to create the shell script, chapters. The script should have these lines:

14. Save the file and exit the editor.

15. Give the file execute permission, and test it. You see output similar to Figure 6-12.

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