Open in TheBrain

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.

  1. Create fruits iterating apples pears oranges mangoes; print each as a fruit. Save, use assigned permission procedure, check ls -l, run.
  2. Create namelist over Ivy Leo Mira; output each. Save and run after checking mode.
  3. 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.
  4. Independently write loop for the four baseball teams and exact repeated sentence requested in the source. Mark loop keywords.
  5. Write command loop for who, ls, pwd; record results and note which depend on current machine/directory.
  6. Explain number of iterations for each; alter one list and rerun.
  7. Summarize script saving, permission checking, invocation, and verification.

Reflection: What is the difference between a list of values and a changing counter variable?