🐚 Shell Scripting Survival Guide
📚 Documentation
Click a picture to open the full guide and its video:
Bash Tutorial
Your first scripts, step by step
Script Template
Production-grade script, with tests
Arguments and Options
$1, getopts and long options
Bash Functions
Scope, results and libraries
Error Handling
set -e, trap, retry and pipefail
Bash Gotchas
The surprises that bite everyone
POSIX sh vs Bash
Scripts that run everywhere
awk and sed in Scripts
Reports, edits and traps
jq in Scripts
JSON in shell scripts, safely
Python
The next step for longer scripts
Scheduling and Monitoring
Cron jobs that do not fail silently
🎬 Every guide has a short video.
For when bash scripting saves the day (or ruins it).
Why do shell scripts never get cold?
Because they always wear .sheets!
Because they always wear .sheets!
Golden Rules
- set -euo pipefail — Your script's safety net
- Always quote your variables: "$VAR" not $VAR
- Test for sudo at the start of admin scripts
⚠️ Warning: rm -rf / is not a debugging tool. Use echo first, then rm.
Essential Snippet
#!/usr/bin/env bash # Always start with this set -euo pipefail # Check for root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" >&2 exit 1 fi # Your code here echo "Deploying to production..."
She said she wanted a bash one-liner...
So I gave her the while loop and took her to dinner.
So I gave her the while loop and took her to dinner.
Coming Soon
- More shell scripting guides, as they get written up