note
philipbailey
<p>The only issue that cannot be resolved by single quoting relevant parts of the command line is of escaping single quotes. Either do this manually, or do something simple like this:</p>
<code>s#'#'\\''#g for ($password, $path);
system("mysqldump --add-drop-table -uroot -p'$password' mydatabase | gzip -9c > '$path'");</code>
<p>Update: s/// command corrected as per [ikegami].</p>
908096
908340