Open in TheBrain

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.

  1. Create fruits over apples, pears, oranges, mangoes; print one sentence per iteration. Save and verify permissions.
  2. Create a name-list script over three names; save, inspect, and run.
  3. Create a word-list loop over one through five; state whether it is a counter and support your explanation.
  4. Write the baseball-team loop and label for, loop variable, in, list, do, body, done.
  5. Write a loop that runs who, ls, and pwd; record live output and explain system dependence.
  6. Make a custom list that is longer, then shorter, than the fruit list; calculate expected passes and verify.
  7. Reorder items and include a duplicate; compare output order and repetition count.
  8. 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?