title: How to execute complex linux commands in Qt?
body: <p>I want to restart the computer by running a command in linux using <code>QProcess</code>. I have hard-coded my root password in my application.</p>
  
  <p>When i run the following in a terminal it works perfect:</p>
  
  <pre><code>echo myPass | sudo -S shutdown -r now 
  </code></pre>
  
  <p>When i put the command in a shell script and call it via <code>QProcess</code> it is also successful :</p>
  
  <pre><code>QProcess process;
  process.startDetached("/bin/sh", QStringList()&lt;&lt; "myScript.sh");
  </code></pre>
  
  <p>But i can not run it by directly passing to <code>QProcess</code>:</p>
  
  <pre><code>process.startDetached("echo myPass | sudo -S shutdown -r now ");
  </code></pre>
  
  <p>It will just print <code>myPass | sudo -S shutdown -r now</code> </p>
  
  <p>How is it possible to run such relatively complex commands directly using <code>QProcess</code>. (Not putting in a shell script).</p>