DevOps: How to train your Bash
summary
An engineer explains concrete rules: always quote variables, use readonly globals and local inside functions, prefer $(...) over backticks, handle args with arrays (declare -a) instead of shifting, use trap for cleanup, enable strict mode and bash -x for debug, and run shellcheck in CI. Shares a real horror: a single Bash grew to ~3,000 lines and caused data loss. Recommends rewriting >100-line scripts in Python; shows fixes that stop accidental rm -rf failures and make scripts debuggable.
AI-written summary · about
chapters (20)
- 0:00Introduction to Bash training
- 4:26What is Bash and its purpose
- 9:23Common Bash script issues
- 12:58Understanding Bash variables
- 13:41Rule one: Always use quotes
- 15:31Rule two: Proper variable assignment
- 18:49Rule three: Use immutable globals
- 20:14Naming parameters for clarity
- 22:22Handling script arguments correctly
- 26:34Using explicit paths in scripts
- 28:24Subshells and their use cases
- 31:53Splitting pipelines for readability
- 33:39Conditional command execution
- 36:31Mastering if statements in Bash
- 39:49Functions and their benefits
- 44:51Functional programming in Bash
- 47:17Strict mode and debugging
- 50:29Logging and ShellCheck
- 53:19Style guides and unit tests
- 54:43When to avoid Bash scripts








