Bash Scripting
Curriculum
Bash · Automation

Bash Scripting Tutorial

A complete Bash scripting path from first scripts to robust automation: quoting, pipelines, functions, getopts, debugging, and production-safe tooling.

65 lessonsBeginner → ProDevOps
Start from the beginning

Curriculum

Work through each section in order. Every lesson ends with practice and key points so the idea sticks.

Beginner

Getting Started

5 lessons · ~55 min
  1. 1
    Welcome to Bash Scripting

    Automate the terminal safely and clearly.

  2. 2
    What is a Shell?

    bash vs sh vs zsh at a glance.

  3. 3
    Your First Script

    Shebang, permissions, execution.

  4. 4
    chmod +x & PATH

    Make scripts runnable.

  5. 5
    quoting Rules

    Single vs double quotes and why it matters.

Beginner

Variables & Input

5 lessons · ~55 min
  1. 6
    Variables

    Assign and expand safely.

  2. 7
    Environment Variables

    export and child processes.

  3. 8
    Positional Parameters

    $1, $@, $#.

  4. 9
    read Input

    Prompt users interactively.

  5. 10
    Default Values

    ${var:-default} patterns.

Beginner

Control Flow

5 lessons · ~55 min
  1. 11
    if & test

    [[ ]] conditions.

  2. 12
    Loops

    for, while, until.

  3. 13
    case Statements

    Menus and routers.

  4. 14
    Functions

    Reusable blocks with local vars.

  5. 15
    Exit Codes

    $? and set -e discipline.

Beginner

Text & Pipelines

5 lessons · ~60 min
  1. 16
    Pipes & Redirection

    |, >, >>, 2>&1.

  2. 17
    grep

    Search with regular expressions.

  3. 18
    sed Basics

    Stream edits.

  4. 19
    awk Basics

    Column processing.

  5. 20
    Project: Log Summarizer

    Count errors by day from a logfile.

Beginner

Files & Safety

5 lessons · ~60 min
  1. 21
    Globs

    Wildcards and nullglob.

  2. 22
    find + xargs

    Act on many files safely.

  3. 23
    set -euo pipefail

    Hard mode for reliable scripts.

  4. 24
    Trap & Cleanup

    Remove temp files on exit.

  5. 25
    Project: Safe Backup Script

    Copy a directory with timestamp.

Intermediate

Intermediate Scripting

5 lessons · ~68 min
  1. 26
    Arrays

    Indexed arrays and iteration.

  2. 27
    Associative Arrays

    Key-value maps in bash 4+.

  3. 28
    Here Documents

    Multi-line input to commands.

  4. 29
    getopts

    Parse flags professionally.

  5. 30
    Project: CLI with Flags

    Build -h/-v/-o options.

Intermediate

Process & Jobs

5 lessons · ~66 min
  1. 31
    Background Jobs

    & and wait.

  2. 32
    Subshells

    ( ) vs { }.

  3. 33
    Command Substitution

    $(...) patterns.

  4. 34
    Parallel-ish Loops

    When to use xargs -P.

  5. 35
    Project: Health Check

    Ping endpoints and report status.

Intermediate

Automation Patterns

5 lessons · ~70 min
  1. 36
    Idempotent Scripts

    Safe to run twice.

  2. 37
    Logging Patterns

    Timestamps and levels.

  3. 38
    Config Files

    Source a config safely.

  4. 39
    Cron Integration

    Schedule your scripts.

  5. 40
    Project: Deploy Hook

    Pull, build, restart service.

Intermediate

Debugging & Testing

5 lessons · ~68 min
  1. 41
    bash -x

    Trace execution.

  2. 42
    Shellcheck

    Static analysis for scripts.

  3. 43
    Bats Testing Overview

    Test shell scripts.

  4. 44
    Common Pitfalls

    Word splitting and globbing bugs.

  5. 45
    Project: Refactor a Messy Script

    Harden an unsafe script.

Intermediate

Advanced Bash

3 lessons · ~39 min
  1. 46
    Namerefs

    declare -n techniques.

  2. 47
    Coprocesses Overview

    Advanced IPC glimpse.

  3. 48
    Performance Tips

    Avoid useless cats and subshells.

Advanced

Advanced Bash

2 lessons · ~36 min
  1. 49
    Security Mindset

    Injection risks in scripts.

  2. 50
    Capstone: Server Bootstrap

    Full bootstrap with logging and flags.

Advanced

Capstone & Career

10 lessons · ~164 min
  1. 51
    Capstone: Dev Toolkit

    Multi-command toolkit in one repo.

  2. 52
    Bash Interview Review

    Quoting, pipes, exit codes, set options.

  3. 53
    Next Steps

    Python for larger tools; keep Bash sharp.

  4. 54
    Final Challenge

    Automate a weekly report from logs.

  5. 55
    Glossary Drill

    pipefail, glob, subshell, shebang, IFS.

  6. 56
    Reading Scripts

    Audit an unfamiliar script safely.

  7. 57
    Portability Notes

    bashisms vs POSIX sh.

  8. 58
    CI Scripting

    Scripts that run in GitHub Actions.

  9. 59
    Portfolio Tips

    Show before/after automation metrics.

  10. 60
    Style Guide

    Consistent formatting and function layout.

Advanced

Practice Labs

5 lessons · ~80 min
  1. 61
    Practice Lab 61

    Hands-on practice lab consolidating earlier bash skills.

  2. 62
    Practice Lab 62

    Hands-on practice lab consolidating earlier bash skills.

  3. 63
    Practice Lab 63

    Hands-on practice lab consolidating earlier bash skills.

  4. 64
    Practice Lab 64

    Hands-on practice lab consolidating earlier bash skills.

  5. 65
    Practice Lab 65

    Hands-on practice lab consolidating earlier bash skills.