Practice Lab 10.17
Practice Lab 10.17 — List Order, Repetition, and Commands
Name: Date:
Instructions
Use Bash, vi, and disposable scripts. Record predictions, exact code, actual output, and explanations. Check mode before running as directed.
- Create and run a fruit loop; print a sentence for each of four values. Explain each iteration.
- Create and run a name loop over three names; inspect permissions and explain how you invoked it.
- Make a loop over number words one through five. Explain whether it is a numeric counter.
- Write the required baseball-team output loop; label
for, variable,in, list,do, body,done. - Write a loop that executes
who,ls,pwd; explain what depends on the host system/current directory. - Reorder one list without changing its items; predict and observe output order. Then add one value and compare iteration count.
- Include a short trace table: pass number, loop variable, body output/command.
- Explain how script saving, permissions, and loop invocation fit together.
Reflection: What changed when you reordered the list, and what stayed constant?