Skip to content

Function: shlex()

shlex(command): string[]

Splits a shell-like command into argv.

Supports:

  • whitespace separators
  • single and double quotes
  • backslash escaping
  • escaped spaces
  • empty quoted strings

If the input is malformed (for example, an unterminated quote), returns the original string as a single argument.

string

string[]