Practice Lab 10.20
Practice Lab 10.20 — Expanded Lab 10 Skills Check
Name: Date:
Instructions
Complete the whole lab in Bash using vi. Use disposable scripts. Before executing, trace list values and predict output. Record exact code and explain the result.
- Create
fruitsover apples, pears, oranges, mangoes; print one sentence per iteration. Save and verify permissions. - Create a name-list script over three names; save, inspect, and run.
- Create a word-list loop over one through five; state whether it is a counter and support your explanation.
- Write the baseball-team loop and label
for, loop variable,in, list,do, body,done. - Write a loop that runs
who,ls, andpwd; record live output and explain system dependence. - Make a custom list that is longer, then shorter, than the fruit list; calculate expected passes and verify.
- Reorder items and include a duplicate; compare output order and repetition count.
- Explain loop prediction, variable substitution, safe command selection, file saving, mode verification, and invocation.
Reflection: What does the list determine, and what does the loop body determine?