escapeshellcmd
(PHP 4, PHP 5)
escapeshellcmd — Escape shell metacharacters
Description
string escapeshellcmd
( string $command
)
Following characters are preceded by a backslash:
#&;`|*?~<>^()[]{}$\, \x0A
and \xFF. ' and "
are escaped only if they are not paired. In Windows, all these characters
plus % are replaced by a space instead.
Parameters
-
command
-
The command that will be escaped.
Return Values
The escaped string.
Examples
Example #1 escapeshellcmd() example
<?php
$e = escapeshellcmd($userinput);
system("echo $e");
$f = escapeshellcmd($filename);
system("touch \"/tmp/$f\"; ls -l \"/tmp/$f\"");
?>