Skip to content

About

A concise, example-driven reference covering Bash shell scripting from basics to advanced topics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Bash Primer

A comprehensive reference for Bash shell scripting — from basics to advanced topics.

Introduction

# Topic Description
01 Unix Shells Shell overview, history, and major shell families
02 Shell Configuration Files Login vs non-login shells, .bashrc, .profile, etc.

Shell Basics

# 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

Variables

# 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

Input / Output & File Operations

# 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

Tests & Operators

# 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

Control Flow & Data Structures

# 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

Commands & Redirection

# 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

Processes & Job Control

# 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

Advanced Topics

# 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

Program Arguments & 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

Debugging

# Topic Description
43 Debugging Bash Scripts set -x, set -e, trap DEBUG, and more

Project Structure

#primer-bash/
├── docs/          ← Markdown notes (one per topic)
├── pics/          ← Diagrams and images
├── codes/         ← Example scripts and supporting files
└── README.md      ← This file

About

A concise, example-driven reference covering Bash shell scripting from basics to advanced topics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages