Open in TheBrain

Practice Lab 10.15

Practice Lab 10.15 — Lab 10 Comprehensive Skills Check

Name: Date:

Instructions

Complete the full loop practice in Bash. Use the prescribed vi workflow and a disposable directory. Record code, predictions, output, and explanations. Verify files and permissions before running.

  1. Write fruits to loop over apples, pears, oranges, mangoes and print one sentence per value. Save, check mode, run.
  2. Write namelist to loop over three names and print each. Save, make executable as directed, verify, run.
  3. Write a loop over number words one through five; explain whether it is a counter and why.
  4. Independently create the Mets/Yankees/Braves/Astros sentence loop. Mark keywords and loop variable.
  5. Write the command loop running who, ls, pwd; execute and explain system-dependent output.
  6. Predict iteration count and output order for each list. Add, remove, duplicate, and reorder values in a custom list; record observed changes.
  7. Explain how many times a for body runs and how each list item becomes the variable value.
  8. Summarize script saving, permissions, invocation, for, in, do, and done.

Reflection: What loop detail will you check first when debugging unexpected output?