title: Using Quotes within getRuntime().exec
body: <p>I'd like to invoke bash using a string as input. Something like:</p>
  
  <pre><code>sh -l -c "./foo"
  </code></pre>
  
  <p>I'd like to do this from Java. Unfortunately, when I try to invoke the command using <code>getRuntime().exec</code>,  I get the following error: </p>
  
  <pre><code>      foo": -c: line 0: unexpected EOF while looking for matching `"'
  
        foo": -c: line 1: syntax error: unexpected end of file
  </code></pre>
  
  <p>It seems to be related to my string not being terminated with an EOF. </p>
  
  <p>Is there a way to insert a platform specific EOF into a Java string? Or should I be looking for another approach, like writing to a temp script before invoking "sh" ?</p>