Lab Examples
Foundations
Start here. These four files show the syntax, quoting and expansion rules from the early lessons. Each one prints its own explanation as it runs.
| # | Description | Link |
|---|---|---|
| 1 | Hello World and exit status | View |
| 2 | Variables, quoting and defaults | View |
| 3 | Expansion and command substitution | View |
| 4 | Indexed and associative arrays | View |
Text & Streams
Redirection, pipelines and globbing — the plumbing that makes small tools compose.
| # | Description | Link |
|---|---|---|
| 5 | Redirection, pipes and here-documents | View |
| 6 | Globbing and safe filename loops | View |
Logic
Branching, iteration, functions and arithmetic. This is where a script becomes a program.
| # | Description | Link |
|---|---|---|
| 7 | Conditionals: if, [[ ]] and case | View |
| 8 | Loops: for, while, until | View |
| 9 | Functions, arguments and return codes | View |
| 10 | Arithmetic and floating point with bc | View |
System & Processes
Files, text processing, background jobs and environment inspection against the real system.
| # | Description | Link |
|---|---|---|
| 11 | File tests, find and safe temp files | View |
| 12 | Text processing with grep, sed and awk | View |
| 13 | Background jobs, wait and traps | View |
| 14 | Environment variables and shell options | View |
Robust Scripts
Two templates to copy into real work: a strict-mode skeleton and a proper command-line parser.
| # | Description | Link |
|---|---|---|
| 15 | Strict-mode template with cleanup | View |
| 16 | Command-line parsing with getopts | View |
Run any demo locally after downloading it:
chmod +x 01_hello.sh
./01_hello.sh
Every demo is a single file with no dependencies beyond Bash and the standard GNU utilities, so it runs on Linux, WSL2 and Git Bash alike.