Skip to content

escapePosixShSqe

escapePosixShSqe(expr): string

Defined in: command/escape-posix-sh-sqe.ts:12

Escape a string to be safely used in a single-quoted shell command.

Example:

const unsafe = "It's a test";
const safe = escapePosixShSqe(unsafe);
console.log(safe); // It'\''s a test

string

string