Practice Lab 10.14
Practice Lab 10.14 — Complete Loop Design Worksheet
Name: Date:
Instructions
Use Bash in the lab environment. Write each script in vi and verify before execution. Record expected output, actual output, and reasoning. Do not just type and run.
- Create a
fruitsloop with four list values, printing a descriptive sentence per iteration; save, check mode, execute. - Create a
namelistloop over three different names; print each value; verify and run. - Use a word list one through five in a loop. Explain why this does not itself maintain a numeric counter.
- Write the exact baseball-team output loop and label the syntax.
- Write a loop that executes
who,ls,pwd; record outputs, state which vary. - Build a custom list with five items, including a repeated item; predict body executions and output; run and compare.
- Reorder that list; explain which result changes and which stays the same. Remove one item and retest.
- Fill in a full explanation of how the loop variable, list, body,
do, anddonework. Include saving, permission checking, and invocation.
Reflection: What distinguishes “repeat for each value” from “count upward”?