Shell Script Linter
Paste a Bash, sh, or zsh script to check for common errors and bad practices. Detects unquoted variables, unsafe patterns, missing set -e, useless cat, and more — with line annotations and fix suggestions.
Frequently Asked Questions
What issues does this linter detect?▼
The linter catches common Bash/shell script problems including: unquoted variables (word splitting/globbing risk), use of backticks instead of $(), ls used for file listing (unsafe), useless cat (UUOC), missing set -e/-u at the top, rm -rf without guards, == vs = in [ ] tests, and function keyword portability issues.
What is SC2086 and why does it matter?▼
SC2086 is the ShellCheck rule for unquoted variables. When you write $var instead of "$var", the shell performs word splitting and glob expansion on the value. This means a variable containing spaces or wildcards can break your command in unexpected ways. Always quote: echo "$filename" not echo $filename.
Why should I use $() instead of backticks?▼
Backtick command substitution (`cmd`) is harder to read, can't be nested easily, and has different escaping rules. The $() form is cleaner, nestable ($(outer $(inner))), and universally supported in modern shells. ShellCheck labels this SC2006.
What does 'set -euo pipefail' do?▼
-e makes the script exit immediately if any command fails. -u treats unset variables as errors. -o pipefail makes pipelines fail if any command in the pipe fails (not just the last one). Together, these three options turn your script into a much safer, fail-fast mode that catches bugs earlier.
When should I use [[ ]] vs [ ] in Bash?▼
In Bash, prefer [[ ]] over [ ] for conditionals. Double brackets support == for string comparison, && and || inside the test, regex matching with =~, and don't require quoting in most cases. Single brackets [ ] follow POSIX rules: use = not ==, and always quote variables.
Why is 'ls | grep' considered bad practice?▼
ls output is not designed for programmatic parsing. Filenames can contain newlines, spaces, or special characters that break ls output. Use find with -name for filtering: find . -name '*.log'. This safely handles all filename edge cases.
Related Products
on GumroadDeveloper Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →Premium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →GitHub Actions CI/CD Templates Pack
12 production-ready GitHub Actions workflow templates covering Node.js, Python, Docker, multi-environment deployments, security scanning, and auto-changelog. Copy, paste, ship.
Buy on Gumroad →You Might Also Need
chmod Calculator
Calculate Unix/Linux file permissions visually. Toggle read/write/execute checkboxes and instantly see octal notation (755), symbolic (rwxr-xr-x), and the ready-to-run chmod command.
Open free tool →
Docker Compose Generator
Generate docker-compose.yml configurations visually in your browser. Add services, ports, volumes, environment variables, and networks. Export production-ready YAML instantly. Free Docker tool.
Open free tool →
Dockerfile Generator
Interactive wizard to generate production-ready Dockerfiles for Node.js, Python, Go, Java, and Rust. Multi-stage builds, port config, custom layers.
Open free tool →
More Free Tools
Related Articles
Bash Scripting: 20 Scripts Every Developer Needs
Stop doing the same tasks manually. These 20 practical Bash scripts automate deployments, backups, file processing, git workflows, and daily developer tasks — ready to copy and use.
Chmod Calculator: Understand Linux File Permissions Without Memorizing Octal
Use a chmod calculator to set Linux file permissions correctly. Convert between symbolic and octal notation, understand rwx bits, and avoid common permission mistakes.
Cron Expression Generator: Build and Understand Cron Schedules
Learn cron expression syntax, build schedules visually, and avoid common mistakes. Includes a cron expression generator tool and reference for every cron format.
Cron Expression Generator Online: Build Cron Schedules Visually Free
Generate cron expressions online for free. Build Linux cron schedules visually, validate cron syntax, and understand every field. Supports 5-field and 6-field cron formats.
DevOps Automation Tools in 2026: Orchestrating the Software Delivery Pipeline
Master DevOps automation with this guide to the tools that orchestrate modern software delivery. Covers CI/CD pipelines, infrastructure provisioning, configuration management, testing automation, and the emerging AI-assisted automation patterns that define 2026.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →