UCE Docs / shell_escape

Signature

String shell_escape(String raw)

Parameters

raw : string that should be escaped
return value : escaped version of 'raw'

Escapes a parameter so it can be used more safely with shell_exec().

This is the helper to reach for when building shell command lines from dynamic input.

Example

print(shell_escape("rm -rf /; echo pwned"), "\n");
Output
'rm -rf /; echo pwned'