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.
- Write
fruitsto loop over apples, pears, oranges, mangoes and print one sentence per value. Save, check mode, run. - Write
namelistto loop over three names and print each. Save, make executable as directed, verify, run. - Write a loop over number words one through five; explain whether it is a counter and why.
- Independently create the Mets/Yankees/Braves/Astros sentence loop. Mark keywords and loop variable.
- Write the command loop running
who,ls,pwd; execute and explain system-dependent output. - Predict iteration count and output order for each list. Add, remove, duplicate, and reorder values in a custom list; record observed changes.
- Explain how many times a
forbody runs and how each list item becomes the variable value. - Summarize script saving, permissions, invocation,
for,in,do, anddone.
Reflection: What loop detail will you check first when debugging unexpected output?