Open in TheBrain

Practice Lab 10.19

Practice Lab 10.19 — for Loops: Data and Command Lists

Name: Date:

Instructions

Use Bash scripts in a disposable directory and the course vi workflow. Record code, permissions, predictions, output, and explanations.

  1. Create fruits, iterating over four fruit values and printing a message per item. Save and run after verifying the file.
  2. Create namelist over three names; print each and check permissions.
  3. Use number words one through five in a message loop; explain the counter question.
  4. Write the required four-team sentence loop, marking keywords and changing value.
  5. Write a command loop for who, ls, pwd; record output and describe what each command reports.
  6. Create a second command list with two safe inspection commands available in your lab; explain why the loop body must invoke each list value. Do not include destructive commands.
  7. For each loop, count list elements, predict body runs, and compare actual runs. Try a duplicate and reordered list.
  8. Explain script save, mode verification, invocation, and output interpretation.

Reflection: Why is practicing with safe inspection commands important when the loop executes commands?