🐚 Bash Script Builder

Build bash scripts from common patterns β€” select blocks, customize, and copy the complete script

Select blocks to include:
Bash Best Practices
β€’ Always start with #!/bin/bash
β€’ Use set -euo pipefail for safety
β€’ Quote variables: "$var" not $var
β€’ Use [[ ]] instead of [ ]
β€’ Check return codes with $?
β€’ Use local in functions

Useful Patterns
trap 'cleanup' EXIT β€” cleanup on exit
read -p "?" var β€” prompt user
$(command) β€” command substitution
"${var:-default}" β€” default value
"${var:?error}" β€” required var

Run Your Script
chmod +x script.sh
./script.sh