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,
PATHand 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,
getoptsand printing helpful usage messages - Safer scripts with
set -euo pipefail,trapand clean-up on exit - Text processing with
grep,sed,awk,cut,sortandxargs - 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:
- Write Bash scripts that handle arguments, errors and awkward filenames correctly.
- Process logs and text files with pipelines of standard tools.
- Schedule scripts with cron or systemd timers and check that they ran.
- Read other people's shell scripts and spot risky patterns.
Course outline
| Module | Topic |
|---|---|
| 1 | Your first script: shebang, permissions and exit codes |
| 2 | Variables, quoting and expansion |
| 3 | Conditionals and tests |
| 4 | Loops and reading files safely |
| 5 | Functions, arguments and getopts |
| 6 | Strict mode, traps and error handling |
| 7 | Pipelines with grep, sed, awk and xargs |
| 8 | JSON and APIs with curl and jq |
| 9 | Scheduling with cron and systemd timers |
| 10 | Linting and testing scripts |
| 11 | Project: 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.