Skip to main content

Bash Script Linter

Paste a bash script to check for common issues: missing safety flags, unquoted variables, deprecated patterns, and best practice violations. Runs entirely in your browser.

✓ set -euo pipefail checks ✓ Variable quoting ✓ Deprecated patterns

Frequently Asked Questions

Why should I use 'set -euo pipefail'?▼

'set -e' exits on error, 'set -u' treats unset variables as errors, 'set -o pipefail' makes pipelines fail if any command fails (not just the last). Together they prevent scripts from silently continuing after errors. Without these, a script can appear to succeed while producing incorrect results.

Why does this linter warn about unquoted variables?▼

An unquoted variable like $var is subject to word splitting and glob expansion. If the variable contains spaces or special characters, it splits into multiple arguments unexpectedly. Always quote variables: "$var". Use "${var}" inside strings. Exception: inside [[ ]] bash conditionals, quotes are less critical but still a good habit.

What is POSIX compatibility and why does it matter?▼

Bash-specific features like [[ ]], arrays, and process substitution don't work in /bin/sh on systems where sh is dash or another POSIX shell. If your shebang is #!/bin/sh, avoid bashisms. If you need bash features, use #!/bin/bash explicitly.

Why avoid 'ls | grep' to find files?▼

Parsing ls output is fragile — filenames can contain spaces, newlines, and other characters that break text parsing. Use glob patterns (for f in *.log) or find with -exec or -print0/xargs -0 instead.

What is a common mistake with [ ] vs [[ ]]?▼

The single bracket [ ] is a POSIX command that requires quoting. The double bracket [[ ]] is a bash keyword with better handling of empty strings and special characters. Use [[ ]] in bash scripts for string comparisons to avoid unexpected behavior with empty variables.

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 →