ch09 · operator · 90-120 min
automation with shell
Write small shell automation that is readable, quoted, checked, and disposable.
You can automate repetitive terminal work without hiding failures.
shellscriptsquotingloopsautomation
Teaching diagramch09 · mental model
shows: The three safety layers of small shell automation — quoting data, null-safe iteration, and guarded action — and how unquoted or unsplit input leaks corruption into the action stage.
does not prove: It is a model, not a guarantee: set -euo pipefail and quoting reduce common failure classes but do not prove a given script is correct or safe on every input.
Lessons in this chapter
capstone
safe automation runbook
Write a small script that scans a disposable log tree, writes a report, and refuses unsafe paths.
DeliverableScript, sample output, and failure transcript for an unsafe path.
Success criteria
- Variables are quoted.
- File iteration is null-safe.
- Failures are visible and intentional.
Terminal Drill companion
Terminal Basics
After your script handles spaces, exits on failure, and prints useful evidence.