Skip to main content

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.

✓ 60K+ developers trust DevPlaybook ✓ Runs 100% in your browser ✓ ShellCheck-style rules

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.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$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.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →