text_bash_escaper
Escape or unescape text for safe use in Bash/shell commands using single, double, backslash, or ansi-c quoting styles to prevent metacharacter parsing issues.
Instructions
Bash CLI Shell Escaper. Escape (or, with reverse, unescape) text for safe use on the Bash/shell command line, choosing one of four quoting styles so the string survives the shell's metacharacter parsing intact. Modes: single (wrap in '...', safest, literal), double (wrap in "...", keeps interpolation, escapes \ " $ `), backslash (prefix each shell metacharacter with , no surrounding quotes), and ansi-c (wrap in $'...' with C-style \n \t \NNN octal escapes for control bytes). Prefer this over text_string_escape when the target is specifically a shell command or script; use text_string_escape for SQL/CSV/JS/regex/PHP/XML syntaxes. Runs locally, read-only, non-destructive, deterministic, and rate-limited (anonymous 30/min, 200/hour, 1000/day). Returns the escaped or unescaped string plus the echoed mode/reverse and input/output lengths.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to escape, or the already-escaped text to unescape when reverse is true. An empty string is allowed. | |
| mode | No | Bash quoting style. single='...' literal (safest); double="..." preserves $ and ` interpolation while escaping \ " $ `; backslash prefixes each metacharacter with a backslash and adds no quotes; ansi-c=$'...' uses C-style and octal escapes for control characters. | single |
| reverse | No | When false (default) escape the text; when true reverse the chosen mode to recover the original string. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | True when the operation succeeded. | |
| input | No | The original text, echoed back. | |
| mode | No | The effective quoting mode used (single, double, backslash, or ansi-c). | |
| reverse | No | Whether the request unescaped (true) or escaped (false). | |
| result | No | The escaped or unescaped output string. | |
| inputLength | No | Character length of the input text. | |
| outputLength | No | Character length of the result string. |