Shell Script Linter
Paste your shell script to check for common issues, deprecated syntax, and best practices instantly.
About This Tool
The Shell Script Linter is a free browser-based tool that checks your bash and shell scripts for common problems, deprecated syntax, and deviations from best practices. It catches issues like unquoted variables, missing shebang lines, deprecated backtick command substitution, useless cat commands, dangerous rm operations, and missing error handling.
The linter implements a subset of the rules found in ShellCheck, the industry-standard static analysis tool for shell scripts. Each issue is tagged with its ShellCheck rule ID (e.g., SC2086 for unquoted variables), so you can look up detailed explanations online. Issues are categorized by severity (error, warning, info) and include auto-fix suggestions where applicable.
A best practices checklist evaluates your script against essential safety
measures: the presence of a shebang line, set -e (errexit),
set -u (nounset), and set -o pipefail. These settings form the
defensive scripting baseline recommended by the
Bash Strict Mode.
If you work with Docker, try the Dockerfile Linter for similar container-focused checks. For validating cron expressions used in shell scripts, the Cron Expression Builder can help. And if you need to build complex Docker commands, check out the Docker Run Command Builder.
All processing runs entirely in your browser. No script content is ever sent to any server. This tool is safe to use with proprietary code and production scripts.
How to Use
- Paste your shell script into the Shell Script textarea on the left, or click Sample to load a demo script with common issues.
- Click Lint or press Ctrl+Enter to run the analysis.
- Review the Results panel on the right. Each issue shows the line number, rule ID, severity, and a description.
- Check the suggestion (lightbulb icon) under each issue for a recommended fix.
- Toggle Auto-lint to automatically analyze the script as you type.
- Review the Best Practices Checklist below the panels to see how your script scores against essential safety measures.
- Click Copy or press Ctrl+Shift+C to copy all results to your clipboard.
Popular Shell Script Examples
FAQ
What shell dialects does this linter support?
The linter checks for issues common to both POSIX sh and Bash scripts. It detects Bash-specific syntax used in POSIX sh context (like == in single brackets or the function keyword with sh shebang) and flags them accordingly. Most rules are based on ShellCheck rule IDs.
What is set -euo pipefail?
This is the 'Bash Strict Mode' combination. set -e exits the script on any command failure, set -u treats unset variables as errors, and set -o pipefail makes pipelines return the exit status of the first failing command. Together they catch most common scripting errors early.
Why should I quote my variables?
Unquoted variables undergo word splitting and globbing. If $var contains spaces or glob characters (*, ?), the shell will split it into multiple arguments or expand it against filenames. Always use "$var" unless you specifically want splitting/globbing.
What is wrong with backticks?
Backtick command substitution (`command`) is the legacy syntax. $() is preferred because it nests cleanly, is easier to read, and handles backslashes consistently. Backticks require escaping backslashes inside them and cannot be nested without complex escaping.
Is this a full replacement for ShellCheck?
No. This tool implements a useful subset of ShellCheck rules for quick browser-based checking. For comprehensive analysis, especially in CI/CD pipelines, use the full ShellCheck tool. This linter is designed for quick spot-checks and learning best practices.
Is my data safe?
Yes. All analysis runs entirely in your browser using JavaScript. No script content, code, or data is ever sent to any server. You can verify this by checking the Network tab in your browser's developer tools while using the tool.
What does the SC prefix mean?
SC stands for ShellCheck. The rule IDs (e.g., SC2086, SC2006) correspond to ShellCheck's rule numbering system. You can search for any SC rule on the ShellCheck wiki to get a detailed explanation with examples.
Related Tools
Makefile Generator
Generate Makefiles visually with targets, dependencies, variables, and templates for C, Go, Node.js, Python, and Docker projects.
GitHub Actions Workflow Builder
Build GitHub Actions workflow YAML files visually. Configure triggers, jobs, steps, matrix strategies, and secrets references.
Dockerfile Linter
Lint and validate Dockerfiles against best practices. Catch common issues before building images.
Cron Expression Builder
Build and validate cron expressions with a visual editor and next run times.
Docker Run Command Builder
Build docker run commands visually with ports, volumes, env vars, and generate docker-compose.yml.
Bash Cheat Sheet
Searchable bash command reference organized by category. File operations, text processing, networking, process management, variables, control flow, and string manipulation.