Catalogue / Infrastructure & systems
Professional Bash scripting: automating Linux administration
Move from the small script that "works on my machine" to a reliable operations tool — expansions, arrays, error handling, options, logs, locks and scheduling — all the way to a production-grade backup script.
A MasterLinux course · Original text
What you will learn
- Manipulate strings without external commands using parameter expansions
- Master quoting, word splitting and globs so file names never break again
- Write precise conditions with [[ ]], regular expressions and (( )) arithmetic
- Build robust loops (NUL separators, subshells, last line, retries)
- Organise code into reusable functions and libraries with controlled scope
- Use indexed and associative arrays to count, group and build safe commands
- Integrate grep, sed and awk into scripts, generate files with here-docs and write them atomically
- Handle errors like in production with set -euo pipefail, trap and documented exit codes
- Offer real options (getopts, long options), log, lock with flock and schedule with cron or systemd
- Apply ShellCheck rules and deliver a complete, tested backup script
Course content
12 lessons · 10 h 20 minSection 1 — The language in depth
Section 2 — Structuring your scripts
- Functions, scope and libraries: reusable code across all your scripts 45 min
- Indexed and associative arrays: lists, counters, grouping and safe commands 45 min
- grep, sed and awk in scripts: passing variables, reading and changing a configuration, going fast 50 min
- Here-docs, here-strings and generated files: configuration templates and atomic writes 40 min
Section 3 — Robustness and operations
Requirements
- The “Fundamentals” course (or able to write a small script with if, for, while and functions)
- Comfortable with redirections, pipes and basic grep, sed and awk
- A Linux machine (VM, WSL or test server) to reproduce the examples
Who is this course for?
- System administrators and operations technicians who automate their daily tasks
- Students preparing for an infrastructure, DevOps or level 2 support role
- Developers who write deployment, backup or CI scripts