Bash and shell · zero to on-call

Scripts that do not surprise you at 3 a.m.

Quoting, exit codes, pipes and traps, with an X-ray that finds what will break before it runs, and a bash playground full of real incidents.

Learning shell scripting?

Start from zero, step by step.

Levels in order, each with a hands-on incident to fix in your browser.

Something broken right now?

Paste the error, get the fix.

The cause, the commands to confirm it and the fix, for every common bash error.

deploy.sh
Script X-ray: every risky line, explained.

Everything you need, from the first script to the 3 a.m. incident.

Fix a broken script. Right here.

A bash shell over a small server, with real error messages. Run the script, edit it, run it again.

Practise on your own machine

Get the scripts

Bash 4 or later, on Linux, macOS (brew install bash) or WSL.

# 1. Get the course
git clone https://github.com/SandeepKomal/Shell.git
cd Shell

# 2. Run the tests: the scripts in throwaway folders
tests/test_scripts.sh

# 3. Try one
./scripts/check_disk_usage.sh 80

Check your own scripts

The habits this course builds, in four commands.

bash -n script.sh        # syntax
shellcheck script.sh     # lint
bash -x script.sh        # trace
env -i HOME="$HOME" PATH=/usr/bin:/bin ./script.sh   # as cron

Or paste it into the Script X-ray. Look up any error in Troubleshoot.

Your path

Progress is saved in this browser only. Tick a level when you have done its lab.

↑ ↓ to move · Enter to open · Esc to close