A comprehensive reference for Bash shell scripting — from basics to advanced topics.
| # | Topic | Description |
|---|---|---|
| 01 | Unix Shells | Shell overview, history, and major shell families |
| 02 | Shell Configuration Files | Login vs non-login shells, .bashrc, .profile, etc. |
| # | Topic | Description |
|---|---|---|
| 03 | Bash Keywords | Reserved words and built-in keywords |
| 04 | Interactive vs Non-Interactive Shells | Shell modes and how to detect them |
| 05 | Auto-Completion | Tab completion and programmable completion |
| 06 | History Management | Command history, search, and HISTCONTROL |
| 07 | Shell Prompt | Customizing PS1, escape sequences, colors |
| 08 | Shell Scripts | Writing and executing shell scripts, shebang |
| # | Topic | Description |
|---|---|---|
| 09 | Shell Variables | Variables, naming, types, and arithmetic |
| 10 | Environment Variables | export, child processes, and persistence |
| 11 | PATH | The PATH variable and command lookup |
| 12 | sudo and Variables |
How sudo affects the environment |
| 13 | Built-in Shell Variables | HOME, PWD, SHELL, USER, etc. |
| 14 | Special Variables | $?, $$, $!, $@, $#, and more |
| # | Topic | Description |
|---|---|---|
| 15 | Input and Output | echo, printf, and read |
| 16 | File and Directory Operations | cp, mv, rm, mkdir, find, tar, etc. |
| 17 | Shell Expansions | Brace, tilde, parameter, arithmetic expansions |
| 18 | Globbing (File Expansion) | Wildcards: *, ?, […], extended globs |
| # | Topic | Description |
|---|---|---|
| 19 | test Command |
test, [, and [[ syntax |
| 20 | Test Operators | File, string, and integer test operators |
| 21 | Bash Operators | Assignment, arithmetic, logical, test, and redirection operators |
| # | Topic | Description |
|---|---|---|
| 22 | Conditional Statements | if…else, case, and select |
| 23 | Loops | for, while, until, break, and continue |
| 24 | Arrays | Indexed arrays, associative arrays, and mapfile |
| 25 | Functions | Defining functions, local variables, return values |
| 26 | Alias | Creating and managing command aliases |
| # | Topic | Description |
|---|---|---|
| 27 | Exit Status | Return codes, $?, and error handling |
| 28 | Command Execution | How Bash finds and runs commands |
| 29 | Command Substitution | $(…) and backtick syntax |
| 30 | Command Chaining | &&, ` |
| 31 | Redirection | >, >>, 2>, &>, here-docs, here-strings |
| # | Topic | Description |
|---|---|---|
| 32 | Background Processes | &, jobs, fg, bg |
| 33 | SIGHUP | Handling hangup signals, nohup, disown |
| 34 | Daemon Processes | Running long-lived background services |
| 35 | Sub-Shells | Parenthesized commands and subshell scope |
| # | Topic | Description |
|---|---|---|
| 36 | Process Substitution | <(…) and >(…) syntax |
| 37 | Regex in Bash | =~ operator, grep, sed, awk |
| 38 | trap |
Signal handling and cleanup routines |
| 39 | Shell Options | set, shopt, and common options |
| # | Topic | Description |
|---|---|---|
| 40 | Command-line Arguments | Positional parameters and shift |
| 41 | Command-line Options | getopts and option parsing |
| 42 | Processing Options | Advanced option processing patterns |
| # | Topic | Description |
|---|---|---|
| 43 | Debugging Bash Scripts | set -x, set -e, trap DEBUG, and more |
#primer-bash/
├── docs/ ← Markdown notes (one per topic)
├── pics/ ← Diagrams and images
├── codes/ ← Example scripts and supporting files
└── README.md ← This file