title: Parse shell quoted string into execv compatible argument vector
body: <p>suppose I have a string like the following</p>
  
  <pre class="lang-sh prettyprint-override"><code>echo "foo" "bar\"blub""baz" "'" "\"" foo\ bar "\\" '\'' """"       Lots" "of\ whitespace
  </code></pre>
  
  <p>Now I want to execute above string as a command as if it was typed into a shell through a call to <code>Unix.execv</code>. If I didn't make any mistakes, then the shell will parse the above into the following ocaml list:</p>
  
  <pre class="lang-ocaml prettyprint-override"><code>["echo"; "foo"; "bar\"blubbaz"; "'"; "\""; "foo bar"; "\\"; "'", "", "Lots of whitespace"]
  </code></pre>
  
  <p>Which library gets me from the original string to the parsed list?</p>
  
  <p>Ultimately I want to hand the resulting list to <code>Unix.execvpe</code>. There is also <code>Unix.open_process_full</code> which is able to handle my original string by using <code>/bin/sh</code> but I discovered that my application is 16% faster when calling the external program directly without <code>/bin/sh</code>. Now I want to be able to accept more input strings including quoting and escapes.</p>
  
  <p>Do I have to roll my own parser?</p>
  
  <p>There exists the POSIX function <code>wordexp</code> but wrapping that function wouldn't solve my issue because <code>wordexp</code> does more than what I want (command substitution, evaluates globs, replaces the tilda and environment variables).</p>
  
  <p>I only want the quoting and escapes to be resolved.</p>