Bash is already on almost every Linux server, CI runner and Mac, which makes it the quickest way to automate repetitive work: backups, deployments, log clean-up, bulk file changes. It is also easy to write scripts that break silently on a filename with a space. This course teaches you to write Bash that is short, readable and safe to run unattended.

What you'll learn

  • How the shell runs a script: shebangs, permissions, PATH and exit codes
  • Variables, quoting and why unquoted variables cause most Bash bugs
  • Conditionals with [[ ]], case, and testing files, strings and numbers
  • Loops over files, lines and command output without the common pitfalls
  • Functions, arguments, getopts and printing helpful usage messages
  • Safer scripts with set -euo pipefail, trap and clean-up on exit
  • Text processing with grep, sed, awk, cut, sort and xargs
  • Working with JSON from the command line using jq
  • Scheduling with cron and systemd timers, and logging what scheduled jobs do
  • Linting with ShellCheck and knowing when to switch to Python instead

Who it's for

  • Developers who copy shell commands from documentation and want to understand them
  • Junior DevOps and support engineers automating server tasks
  • Anyone who runs the same sequence of commands more than once a week

Prerequisites

  • Basic familiarity with a terminal: moving between folders and running commands (see Linux Command Line for Developers)
  • Access to Linux, macOS, or Windows with WSL or Git Bash
  • No prior programming experience is required

Outcomes

By the end of this course you will be able to:

  1. Write Bash scripts that handle arguments, errors and awkward filenames correctly.
  2. Process logs and text files with pipelines of standard tools.
  3. Schedule scripts with cron or systemd timers and check that they ran.
  4. Read other people's shell scripts and spot risky patterns.

Course outline

ModuleTopic
1Your first script: shebang, permissions and exit codes
2Variables, quoting and expansion
3Conditionals and tests
4Loops and reading files safely
5Functions, arguments and getopts
6Strict mode, traps and error handling
7Pipelines with grep, sed, awk and xargs
8JSON and APIs with curl and jq
9Scheduling with cron and systemd timers
10Linting and testing scripts
11Project: an automated backup and log rotation script

FAQ

Bash or Zsh?

macOS uses Zsh as its default interactive shell, but servers and CI systems overwhelmingly run Bash scripts. The scripting skills transfer, and we flag the few differences.

When should I use Python instead?

When a script needs complex data structures, a lot of error handling or grows past a page or two. The course gives clear rules of thumb, and Python for Automation picks up from there.

Will this work on Windows?

Yes, through WSL or Git Bash. Some system tools such as systemd timers need a Linux environment, which WSL provides.

How do I join?

Get in touch and we'll share the current format, schedule and enrolment details.