Chapter 1
Bash in depth
Updated July 3, 2026
In the earlier parts you wrote short commands and rarely a script longer than ten lines. Here a script becomes a tool that runs from cron, in CI, in someone else's hands. And the main requirement shifts: the script has to fail loudly instead of quietly carrying on after the first error.
By default Bash forgives almost everything. A command fails, the shell prints an error and moves to the next line. A variable is unset, an empty string gets substituted. A pipeline returns success even though its first stage broke. The very first line of any serious script fixes these three habits.
#!/usr/bin/env bash
set -euo pipefailset -e stops the script on the first command that returns a non-zero code. set -u turns a reference to an unse
The rest of this chapter is part of a paid course
You are reading the open part. Buy the course to read the whole chapter.