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.
- Create
fruitswith a loop over four fruits and a message using its loop variable. Save and exit; verify; set permissions as assigned; run. - Create
namelistthat prints three names, checking executable mode and output. - Write the
countword-list example for one through five, print its current value, and explain whether it is a numeric counter. - Write the requested team loop for Mets, Yankees, Braves, Astros; identify list, variable, keywords, and output string.
- Write the command loop for
who,ls,pwd; run and compare with predicted output. Mark which results vary by system. - 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.
- Complete a short review of script saving, permission inspection, invocation, and loop keywords.
Reflection: What did duplicate list items demonstrate about list-driven repetition?