diff --git a/cmpUtil.php b/cmpUtil.php index cd64e18..65bfbf3 100644 --- a/cmpUtil.php +++ b/cmpUtil.php @@ -250,8 +250,7 @@ } - - function cmpSysExec($cmaRaw, $opt = []) { + function cmpShellEscArr($cmaRaw) { $ttr = array( "\t" => "\\\t", "\$" => "\\\$", "\\" => "\\\\", "\"" => "\\\"", @@ -277,7 +276,18 @@ $cmaEsc[] = strtr($cmaRaw[$i], $ttr); } - $cmdStr = join(" ", $cmaEsc); + return $cmaEsc; + } + + function cmpShellEscStr($cmaRaw) { + $cmaEsc = $this->cmpShellEscArr($cmaRaw); + + return join(" ", $cmaEsc); + } + + function cmpSysExec($cmaRaw, $opt = []) { + $cmdStr = $this->cmpShellEscStr($cmaRaw); + if(!@$opt["silent"]) { $this->d("cmpSysExec: " . $cmdStr); }