🎯 About this course
You already type commands. This course turns the chores you repeat into scripts that other people can trust: they take arguments, check their input, fail loudly and run on a schedule. Every exercise names who needs the script and why it is done that way, and a simulated machine runs your scripts and checks the result.
By the end you will be able to
- Write a shell script with a shebang, a header and the right permission, and run it three ways, explaining the difference.
- Use arguments, defaults and required values to give a script inputs, and quote variables so that awkward values do not break it.
- Use if, tests and case to choose between branches, and make a script refuse to run when its input is wrong.
- Write for, while read and until loops that process files and the lines of a CSV, and explain why a pipe loses a loop's variables.
- Write functions with local variables and shared libraries, use arrays and lookups, and clean and total text with cut, sed, awk and here-documents.
- Write scripts that handle any file name safely, using quotes, --, NUL-separated lists and temporary files that clean themselves up.
- Use strict mode and exit statuses so that a failing script stops and says so, and check inputs with clear messages and the right status.
- Write scripts that clean up with traps, write results atomically and take locks, and debug a failing script with bash -n, set -x and bisection.