Bash Scripting for Engineers
Most operational automation still starts as a Bash script. Learn to write scripts that are readable, safe (quoting, error handling, idempotency), testable, and ready to run from cron or systemd.
What you'll be able to do
- Write scripts with correct quoting, arguments and exit codes
- Process text and JSON with grep, sed, awk and jq
- Make scripts safe with set -euo pipefail, traps and idempotent steps
- Lint and test scripts with shellcheck and bats
Before you start
Linux Level 1.
How it works
Each lesson: plain-language idea → how it really works → hands-on. Each section ends with a cheat sheet & self-check.
Curriculum
Lessons marked “Read” are ready; the rest are on the way.
Modules
- 01Scripts, variables & quotingShebang, variables, and why quotes matterRead →
- 02Conditions & loopsif, test, case, for, whileRead →
- 03Functions & argumentsFunctions, $@, getopts, usage messagesRead →
- 04Text processinggrep, sed, awk, cut, sort, uniq, jqRead →
- 05Safe scriptsset -euo pipefail, traps, temp files, idempotencyRead →
- 06Scheduling & automationcron, systemd timers, lockingRead →
- 07Testing & lintingshellcheck, bats, CI for scriptsRead →
- 08Capstone: a real ops scriptHealth check with logging, retries and alertsRead →
- 📋Cheat sheet & self-checkEvery command from this section on one page, then 25 questions to check yourself.Open →
Real-world scenarios
Work through each one: symptom → misleading signal → evidence → root cause → prevention.
rm -rf "$DIR/" with an empty variable, and the one line that prevents it.
PATH, environment and working directory differences.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.