Bash Scripts That Loop Over Input

Write four small scripts that act on a list: over their arguments, over the lines of a host inventory, over a directory of logs and over the output of a monitoring command. Each one is then run on input you have not seen.

Skill labintermediate~30 minPro

What you'll do

  • ✓Loop over a script's arguments without breaking on spaces or wildcards
  • ✓Read a file line by line into fields and choose a branch with case
  • ✓Loop over files, capture a command's output and add up with shell arithmetic
  • ✓Turn the output of a command into a result file and an exit status

Lab outline

  1. 01Arguments and data
  2. 02Lines and files
  3. 03A command's output

Before you start

  • Shell Environment and a Repeatable Inventory
  • Search Logs and Build Pipelines

Every lab runs on a real machine of your own in the browser — no installs, nothing to clean up — and checks your work automatically as you go.

← All Linux System Administration labs

Your first machine is
8 seconds away.

Learn by doing on real machines — and give every AI agent one of its own.

Free forever · No credit card · Cancel anytime

Bash Scripts That Loop Over Input — Linux lab | Kube Labs