@ac-essentials/misc-util
    Preparing search index...

    Function escapePosixShCommandArg

    • Escape a string to be safely used as a shell argument in POSIX-compliant shells

      It adds single quotes around a string and quotes/escapes any existing single quotes.

      Example:

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

      Parameters

      • expr: string

        The string to escape

      Returns string

      The escaped string