Quote

str_quote

Wrap a string in quotes or bracket-style enclosures. Defaults to double quotes. Supports single quotes, backticks, parentheses, braces, brackets, and chevrons via flags.

Arguments

  • $1 (string): Optional: -s|--single, -b|--backticks, -P|--parens,
  • ... (string): The string to wrap

Exit codes

  • 0: Always

Output on stdout

  • The input string wrapped in the selected enclosure

str_unquote

Remove all single-quote, double-quote, and backtick characters from a string. This strips every occurrence, not just surrounding pairs.

Example

  str_unquote "'Hello', \"World\""   # => Hello, World
  str_unquote '"wrapped"'            # => wrapped
Adapted from dylanaraps/pure-bash-bible (MIT) https://github.com/dylanaraps/pure-bash-bible

Arguments

  • $1 (string): Input string

Exit codes

  • 0: Always

Output on stdout

  • The string with all quote characters removed