Learning Hub › Bash 8 Hours

Bash 8-Hour Interactive Crash Course

For Senior Cloud Engineers · Shell Mechanics → Variables and Control Flow → Functions and Modularization → Error Handling and Defensive Scripting → Text and Data Processing → Ops Automation → Testing, Debugging and Portability → Production Issues and Interviews (optional) · 8 lessons × 1 hour, running through the opsctl project
Bash 5.3ShellCheckbats-corejq / yqRunning project: opsctlVerified 2026-11-17
Learning path: ← Linux 8 hours ① How Bash Works: Command Line and Shell Mechanics ② Variables, Data and Control Flow ③ Functions, Scope and Modular Scripts ④ Robustness: Error Handling and Defensive Scripting ⑤ Text and Data Processing ⑥ Automation in Practice: Ops Scripts and Cloud CLIs ⑦ Testing, Debugging, Quality and Portability ⑧ 50 Production Issues + 50 Interview Questions (optional) Next course: Git 8 Hours →

8 lessons

Hour 1How Bash Works: Command Line and Shell MechanicsWhat a shell is: interactive vs. script, startup files and shebang; kinds of commands: builtins, keywords, functions, aliases and external commands; quoting: single quotes, double quotes, $'…' and escapes; the seven expansion steps and their order; redirection and file descriptors; pipes; exit status and && / ||; variables, environment and subshells; your first script: from the command line to an executable fileBash 5.3 · GNU coreutils
Hour 2Variables, Data and Control FlowParameter expansion: defaults, trimming, replacement and length; arithmetic: $(( )), let and integer pitfalls; arrays and associative arrays; conditionals: [[ ]], test and case; loops: for, while, until and loop control; reading input safely: read -r, IFS and mapfile; here documents, here strings and process substitution; control flow practice: a log statistics toolParameter expansion · Arrays · [[ ]] · read
Hour 3Functions, Scope and Modular ScriptsFunctions: definition, arguments and return values; scope: local, dynamic scope and global variables; output and return: command substitution, return and nameref; modularization: source, library files and naming conventions; argument parsing: getopts and long options; subcommand-style CLI design: usage, help and exit code conventions; configuration: config files, environment variables and precedence; opsctl v0.1: a maintainable script skeletonFunctions · local · nameref · getopts
Hour 4Robustness: Error Handling and Defensive ScriptingStrict mode: the real behavior and pitfalls of set -e, -u and -o pipefail; trap: EXIT, ERR, INT and cleanup; temporary files and directories: mktemp and safe cleanup; concurrency and locking: flock and idempotency; logging and observability: log functions, levels and stderr; retries, backoff and timeouts; security: injection, eval, glob and untrusted input; opsctl v0.2: defensive hardeningset -euo pipefail · trap · mktemp · flock
Hour 5Text and Data Processinggrep and regular expressions; sed: substitution, addresses and in-place editing; awk: fields, patterns and aggregate reports; find, xargs and safe handling of filenames; sorting and set operations: sort, uniq, join, comm, cut, paste; JSON and YAML: jq and yq; the limits of CSV and structured data; opsctl logs: log analysis reportsgrep · sed · awk · find · jq · yq
Hour 6Automation in Practice: Ops Scripts and Cloud CLIsCalling HTTP APIs: curl, status codes, retries and pagination; scripting cloud CLIs: --query, --output and jq with az and aws; bulk operations: parallel execution and SSH loops; deployment scripts: health checks, rollback and atomic switchover; backup and rotation scripts; scheduled execution: cron and systemd timers; running scripts in CI: GitHub Actions / GitLab CI; opsctl v0.3: health, backup and deploycurl · az · aws · systemd timer · CI
Hour 7Testing, Debugging, Quality and PortabilityDebugging: set -x, PS4, BASH_XTRACEFD and caller; static analysis: ShellCheck rules and suppression; formatting and style: shfmt and style guides; testing: bats-core, assertions and test doubles; performance: avoiding subshells, preferring builtins and profiling; portability: POSIX sh, dash, Bash 3.2 on macOS and BusyBox; when not to use Bash: signs it's time to move to Python / Go; opsctl v1.0: testing, CI and releasebats-core · ShellCheck · shfmt · set -x
Hour 8 · Optional50 Production Issues + 50 Interview QuestionsQuoting, expansion and variables, control flow, input and text processing, error handling, signals and concurrency, environment, portability, CI and security, shell mechanics and basics, script design and data processing, robustness, testing and debugging, real-world scenarios and code reviewBash 5.3

The progress bars on the cards show each lesson's learning progress saved in this browser (hidden if the browser blocks local storage).

Full outline and time allocation (7 × 1 hour + optional Hour 8)

Lesson / ModuleTimeTopic
Hour 1 · How Bash Works: Command Line and Shell Mechanics (Open)
1-0Pre-classEnvironment setup (Bash 5.x lab environment and ~/bashlab)
1-100–06What a shell is: interactive vs. script, startup files and shebang
1-206–13Kinds of commands: builtins, keywords, functions, aliases and external commands
1-313–21Quoting: single quotes, double quotes, $'…' and escapes
1-421–28The seven expansion steps and their order
1-528–35Redirection and file descriptors
1-635–42Pipes, exit status and && / ||
1-742–50Variables, environment and subshells
1-850–60Your first script: from the command line to an executable file
Hour 2 · Variables, Data and Control Flow (Open)
2-0Pre-classBridge and warm-up (sample dataset)
2-100–06Parameter expansion: defaults, trimming, replacement and length
2-206–13Arithmetic: $(( )), let and integer pitfalls
2-313–21Arrays and associative arrays
2-421–28Conditionals: [[ ]], test and case
2-528–35Loops: for, while, until and loop control
2-635–42Reading input safely: read -r, IFS and mapfile
2-742–50Here documents, here strings and process substitution
2-850–60Control flow practice: log statistics tool
Hour 3 · Functions, Scope and Modular Scripts (Open)
3-0Pre-classPrep: opsctl project skeleton
3-100–06Functions: definition, arguments and return values
3-206–13Scope: local, dynamic scope and global variables
3-313–21Output and return: command substitution, return and nameref
3-421–28Modularization: source, library files and naming conventions
3-528–35Argument parsing: getopts and long options
3-635–42Subcommand-style CLI design: usage, help and exit code conventions
3-742–50Configuration: config files, environment variables and precedence
3-850–60opsctl v0.1: a maintainable script skeleton
Hour 4 · Robustness: Error Handling and Defensive Scripting (Open)
4-0Pre-classPrep: failure scenario scripts
4-100–06Strict mode: the real behavior and pitfalls of set -e, -u and -o pipefail
4-206–13trap: EXIT, ERR, INT and cleanup
4-313–21Temporary files and directories: mktemp and safe cleanup
4-421–28Concurrency and locking: flock and idempotency
4-528–35Logging and observability: log functions, levels and stderr
4-635–42Retries, backoff and timeouts
4-742–50Security: injection, eval, glob and untrusted input
4-850–60opsctl v0.2: defensive hardening
Hour 5 · Text and Data Processing (Open)
5-0Pre-classPrep: log, CSV, JSON and YAML datasets
5-100–06grep and regular expressions (BRE / ERE / PCRE)
5-206–13sed: substitution, addresses and in-place editing
5-313–21awk: fields, patterns and aggregate reports
5-421–28find, xargs and safe filename handling
5-528–35Sorting and set operations: sort, uniq, join, comm, cut, paste
5-635–42JSON and YAML: jq and yq
5-742–50The limits of CSV and structured data
5-850–60opsctl logs: log analysis reports
Hour 6 · Automation in Practice: Ops Scripts and Cloud CLIs (Open)
6-0Pre-classPrep: cloud account (optional) and API sandbox
6-100–06Calling HTTP APIs: curl, status codes, retries and pagination
6-206–13Scripting cloud CLIs: --query, --output and jq with az and aws
6-313–21Bulk operations: parallel execution and SSH loops
6-421–28Deployment scripts: health checks, rollback and atomic switchover
6-528–35Backup and rotation scripts
6-635–42Scheduled execution: cron and systemd timers
6-742–50Running scripts in CI: GitHub Actions / GitLab CI
6-850–60opsctl v0.3: health, backup and deploy
Hour 7 · Testing, Debugging, Quality and Portability (Open)
7-0Pre-classPrep: testing and CI toolchain
7-100–06Debugging: set -x, PS4, BASH_XTRACEFD and caller
7-206–13Static analysis: ShellCheck rules and suppression
7-313–21Formatting and style: shfmt and style guides
7-421–28Testing: bats-core, assertions and test doubles
7-528–35Performance: avoiding subshells, preferring builtins and profiling
7-635–42Portability: POSIX sh, dash, Bash 3.2 on macOS and BusyBox
7-742–50When not to use Bash: signs it's time to move to Python / Go
7-850–60opsctl v1.0: testing, CI and release
Hour 8 (optional) · 50 Production Issues + 50 Interview Questions (Open)
8-0Pre-classInstructions and failure lab environment
8-100–08A · Quoting, expansion and variables (questions 1–12)
8-208–16A · Control flow, input and text processing (13–25)
8-316–24A · Error handling, signals and concurrency (26–38)
8-424–30A · Environment, portability, CI and security (39–50)
8-530–37B · Shell mechanics and basics (interview 1–13)
8-637–44B · Script design and data processing (14–25)
8-744–52B · Robustness, testing and debugging (26–38)
8-852–60B · Real-world scenarios and code review (39–50)

Pagination for each module

Hours 1–7: principles (What / Why / How / When) · diagrams · animations · commands · labs · production cases · troubleshooting · quizzes · English narration · videos. Hour 8: the production-issues part has overview · issue details · diagrams · animations · reproduction labs · quiz · narration · video; the interview part has overview · interview question details · diagrams · mock interview · scenario questions · quiz · narration · video. Each lesson ends with a cheat sheet, a comprehensive lab, a final quiz, and a note on sources and versions.

Lab environment

Animations and narration: Animations are implemented with inline SVG and JavaScript and play offline; the narration pages use the browser's built-in Web Speech API (en-US) to read the lecture script aloud.
Limitations: Lab commands are written from the official documentation and have not been run step by step in a real environment; IDs, IPs and times in the expected output are sample values. The authoring environment cannot produce videos or MP3 files, so the video pages list only verified public videos with storyboard scripts; details that could not be verified are noted on each lesson’s “Sources and version notes” page.