title: Bash - stderr captured before stdout
body: <p>I'm trying to capture both stderr and stdout to a variable using the following code:</p>
  
  <pre><code>FileIDs="$(plutil -key "ID" file1.plist file2.plist file3.plist file4.plist 2&gt;&amp;1)"
  </code></pre>
  
  <p>However, when I echo the contents stored in the variable, any stderr lines show up first followed by stdout lines.</p>
  
  <pre><code>Error: File not found at path file3.plist
  File1ID
  File2ID
  File4ID
  </code></pre>
  
  <p>If this <code>plutil -key "ID" file1.plist file2.plist file3.plist file4.plist 2&gt;&amp;1</code> is executed at a terminal the output is printed as expected:</p>
  
  <pre><code>File1ID
  File2ID
  Error: File not found at path file3.plist
  File4ID
  </code></pre>
  
  <p>What can I do to capture both stderr and stdout in the correct order?</p>