Practice Lab 10.5
Practice Lab 10.5 — Full Bash List Iteration Worksheet
Name: Date:
Instructions
Use the assigned Bash shell, vi, and disposable files. Before execution, mark each loop’s list and predict output order/count. Record what actually happens and why.
- Create
fruitsiteratingapples pears oranges mangoes; print each as a fruit. Save, use assigned permission procedure, checkls -l, run. - Create
namelistoverIvy Leo Mira; output each. Save and run after checking mode. - Create a loop over spelled-out numbers one to five. Include variable in a sentence. Explain why this iterates over strings rather than performing arithmetic.
- Independently write loop for the four baseball teams and exact repeated sentence requested in the source. Mark loop keywords.
- Write command loop for
who,ls,pwd; record results and note which depend on current machine/directory. - Explain number of iterations for each; alter one list and rerun.
- Summarize script saving, permission checking, invocation, and verification.
Reflection: What is the difference between a list of values and a changing counter variable?