Liking cljdoc? Tell your friends :D

hive-system.shell.posix

Pure POSIX shell-quoting helpers.

Two functions:

  • shell-quote — single-quote a string for safe embedding in a sh -c command, escaping embedded single-quotes and quoting the empty string as '' so it survives tokenization.
  • join-as-cmd — join an argv into one shell-command string by quoting each element with shell-quote.

Re-quoting an already-quoted string nests correctly — each sh -c peel removes exactly one quoting layer.

Pure POSIX shell-quoting helpers.

Two functions:

  - `shell-quote` — single-quote a string for safe embedding in a
    `sh -c` command, escaping embedded single-quotes and quoting the
    empty string as `''` so it survives tokenization.
  - `join-as-cmd`  — join an argv into one shell-command string by
    quoting each element with `shell-quote`.

Re-quoting an already-quoted string nests correctly — each `sh -c`
peel removes exactly one quoting layer.
raw docstring

join-as-cmdclj/s

(join-as-cmd argv)

Quote every element of argv with shell-quote and join with spaces into a single command string suitable for sh -c.

Quote every element of `argv` with `shell-quote` and join with spaces
into a single command string suitable for `sh -c`.
sourceraw docstring

shell-quoteclj/s

(shell-quote arg)

POSIX single-quote arg for safe embedding in a sh -c command.

  • empty string → '' (otherwise it would collapse into adjacent whitespace during sh tokenization)
  • string with shell metacharacters → '…', with embedded ' rewritten as '\''
  • otherwise → returned unchanged.
POSIX single-quote `arg` for safe embedding in a `sh -c` command.

- empty string → `''` (otherwise it would collapse into adjacent
  whitespace during sh tokenization)
- string with shell metacharacters → `'…'`, with embedded `'`
  rewritten as `'\''`
- otherwise → returned unchanged.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close