title: Passing two strings to the external utility diff in Julia
body: <p>I've been trying to pass two strings to the <code>diff</code> command line utility for its graphical side-by-side comparison capabilities in Julia. My attempts thus far have included the following:</p>
  <pre><code>s1 = &quot;&lt;very long multiline string 1&gt;&quot;
  s2 = &quot;&lt;very long multiline string 2&gt;&quot;
  
  # Results in LoadError: parsing command `diff -y &lt;(echo $(s1)) &lt;(echo $(s2))`:
  # special characters &quot;#{}()[]&lt;&gt;|&amp;*?~;&quot; must be quoted in commands
  attempt1 = read(`diff -y &lt;(echo $(s1)\) &lt;(echo $(s2))`, String)
  
  # Results in diff: extra operand '&lt;(echo'
  attempt2 = read(`diff -y \&lt;\(echo $(s1)\) \&lt;\(echo $(s2)\)`, String)
  
  # Results in diff: missing operand after '&lt;(echo
  attempt3 = read(`diff -y &quot;&lt;(echo $(s1)) &lt;(echo $(s2))&quot;`, String)
  
  # Results in diff: missing operand after '&lt;(echo $(s1)) &lt;(echo $(s2))'
  attempt4 = read(`diff -y '&lt;(echo $(s1)) &lt;(echo $(s2))'`, String)
  
  # Results in diff: &lt;(echo &lt;very long multiline string 1&gt;: Filename too long
  attempt5 = read(`diff -y \&lt;\(&quot;echo $(s1)&quot;\) \&lt;\(&quot;echo $(s2)&quot;\)`, String)
  </code></pre>
  <p>and so forth. The strings <code>s1</code> and <code>s2</code> are generated during the execution of a script and are therefore not accessible as files. I'm trying to bypass that with the bash &quot;pseudo-file&quot; syntax</p>
  <pre class="lang-sh prettyprint-override"><code>diff -y &lt;(command 1) &lt;(command 2) ,
  </code></pre>
  <p>but Julia does something to the command strings so that they don't operate as they do in bash. How might I pass two strings to <code>diff</code> in Julia, then?</p>