title: Escaping Shell Commands In java?
body: <p>I have a webservice that will take some input from authenticated machines as XML (this is for a network management system that I am integrating with some other software) and execute a shell script with some of the XML data as arguments.</p>
  
  <p>In Java(/Linux), what is the best way to escape shell commands to ensure someone cannot pass malicious arguments to my webservice?</p>
  
  <p>Basically in an extremely simplified example, Im taking some input in via WS</p>
  
  <pre><code>&lt;foo&gt;
  &lt;bar&gt;ABCDEF&lt;/bar&gt;
  &lt;/foo&gt;
  
  then running somescript.pl &lt;&lt;data in &lt;bar&gt; field&gt;&gt; here
  </code></pre>
  
  <p>I need to ensure that this cannot be used to execute arbitrary shell commands,etc.</p>
  
  <p>Thanks!</p>