Shell Scripting & Automation
Bash that fails loudly instead of lying, text pipelines that answer real questions from a log, a script with options and exit codes others can rely on, and a scheduled job proven under cron's own conditions.
- 4 labs
- about 2.9 hours
- Beginner to Intermediate
Labs in this course
- 01Bash That Fails Loudly: The Backup That Said OKBeginner · 44 min
- 02Text Pipelines: Answer Neha's Questions from a LogBeginner · 44 min
- 03A Script Others Can Use: Arguments, Options & Exit CodesIntermediate · 44 min
- 04Scheduled Jobs: Rotate Kestrel's Log with cronIntermediate · 44 min
What you will be able to do
- Read exit statuses with $? and know what a script's own status is
- Use set -euo pipefail and know what each of the three parts catches
- Count exactly what you mean with grep, not everything that contains the digits
- Split lines into fields with awk and pull out the hour
- Write an executable script in ~/bin that takes a positional argument
- Parse options with getopts and validate their values
- Rotate a log by renaming, and know when renaming is safe
- Write an /etc/cron.d entry with a schedule, a user and a command
How a lab works
Each lab opens a fresh machine beside the instructions. You work in a real terminal; when you finish a task, the platform checks the machine itself and tells you what is still wrong. The machine is disposable and is removed when the timer ends, but your progress is kept.