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.

#DescriptionLink
1Hello World and exit statusView
2Variables, quoting and defaultsView
3Expansion and command substitutionView
4Indexed and associative arraysView

Text & Streams

Redirection, pipelines and globbing — the plumbing that makes small tools compose.

#DescriptionLink
5Redirection, pipes and here-documentsView
6Globbing and safe filename loopsView

Logic

Branching, iteration, functions and arithmetic. This is where a script becomes a program.

#DescriptionLink
7Conditionals: if, [[ ]] and caseView
8Loops: for, while, untilView
9Functions, arguments and return codesView
10Arithmetic and floating point with bcView

System & Processes

Files, text processing, background jobs and environment inspection against the real system.

#DescriptionLink
11File tests, find and safe temp filesView
12Text processing with grep, sed and awkView
13Background jobs, wait and trapsView
14Environment variables and shell optionsView

Robust Scripts

Two templates to copy into real work: a strict-mode skeleton and a proper command-line parser.

#DescriptionLink
15Strict-mode template with cleanupView
16Command-line parsing with getoptsView

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.