Bash POSIX Portability Checker
Find common Bashisms and make shell scripts portable, entirely in your browser
About
A deterministic, quote-aware line and token scanner for common Bashisms including conditionals, arrays, arithmetic commands, functions, local variables, source, case modification, and echo options. No script leaves your device.
Examples
Double-bracket conditional
checkBashPosixPortability("if [[ $x == y ]]; then\n echo hi\nfi")[{ line: 1, bashism: "[[ ]] conditional", suggestion: "Use [ ... ] ..." }]The [[ token survives quote-stripping, so line 1 is flagged with a bracket-test rewrite.
Quoted lookalike ignored
checkBashPosixPortability("printf '%s' '[[ not code ]]'"){ findings: [], score: 100 }Single-quoted text is removed before testing, so the [[ inside quotes is not code.
About this tool
Bash POSIX Portability Checker scans shell scripts with checkBashPosixPortability(script) (alias analyzeBashScript): each line is stripped to code-only text (single/double quotes and # comments removed, ${...} preserved inside double quotes) and tested against twelve Bashism rules.
Rules cover [[ ]], (( )), array assignment/expansion, == comparisons, += assignment, the function keyword, ${var^^} case modification, local, source, echo -e/-n, and $'...' quoting — every hit records a 1-based line, the Bashism name, and a POSIX rewrite suggestion.
Scoring is deterministic: zero findings score 100, otherwise 100 minus findings-per-line times 20 (floored at 0), with the line count of the script returned alongside.
How to use this tool
Paste the script
Pass the full script text — shebang included — to checkBashPosixPortability.
Read findings
Each finding names the Bashism, its line, and the POSIX suggestion to apply.
Aim for 100
Rewrite flagged lines ([ ... ], printf, . file) until findings empty out and score returns to 100.
Use cases
Porting scripts to dash
Find every Bash-only construct before switching #!/bin/sh to a minimal POSIX shell.
Reviewing install scripts
Catch +=, arrays, and source in cross-platform setup scripts during code review.
Teaching POSIX shell
Show the suggested rewrite for each Bashism as a portable-shell lesson.
Common mistakes
Mistake:Assuming quoted examples are checked.
Fix:Single/double-quoted text and # comments are stripped first — only real code is tested.
Mistake:Using source or == in #!/bin/sh scripts.
Fix:Use the dot command (. file) and single = for comparisons; both have dedicated rules.
Frequently asked questions
What does this tool do?
It scans shell scripts with checkBashPosixPortability against twelve Bashism rules ([[ ]], (( )), arrays, ==, +=, function, case modification, local, source, echo flags, $'...') and returns line-tagged findings with POSIX suggestions plus a 0–100 score.
How is the score computed?
Zero findings score 100; otherwise 100 minus findings-per-line times 20, floored at 0.
Is my script uploaded or stored?
No. Quote-aware line scanning and scoring run entirely in your browser.
Why was quoted code ignored, or += flagged?
Single/double-quoted text and # comments are stripped before testing so examples like '[[ ]]' never flag, while real code such as path+=/bin matches the += rule with a POSIX concatenation suggestion.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
AI Function Calling Schema Generator
Generate function calling JSON schemas from TypeScript interfaces
Algorithm Arena & Data Structure Visualizer
Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.
Ansible Playbook Generator
Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML