&1)*(\s*\|)|$/', ' 2>&1$2', $command); $arguments = array_map('escapeshellarg', $arguments); if (empty($arguments)) { return $command; } return vsprintf($command, $arguments); } }