Open in TheBrain

Practice Lab 10.8

Practice Lab 10.8 — Integrated Bash for Loop Lab

Name: Date:

Instructions

Complete all parts in a disposable folder using the class shell and vi. Predict output and iteration counts before each run. Record exact commands and explain results.

  1. Create fruits with a loop over four fruits and a message using its loop variable. Save and exit; verify; set permissions as assigned; run.
  2. Create namelist that prints three names, checking executable mode and output.
  3. Write the count word-list example for one through five, print its current value, and explain whether it is a numeric counter.
  4. Write the requested team loop for Mets, Yankees, Braves, Astros; identify list, variable, keywords, and output string.
  5. Write the command loop for who, ls, pwd; run and compare with predicted output. Mark which results vary by system.
  6. Make one list contain a duplicate and another contain an added value. Predict and observe how many times the body runs and what it prints.
  7. Complete a short review of script saving, permission inspection, invocation, and loop keywords.

Reflection: What did duplicate list items demonstrate about list-driven repetition?