title: Is the redirect in bash hierarchical?
body: <p>There's an example explaining how the order of redirect command will affect the final result in the manual of <code>bash</code> as</p>
  <blockquote>
  <p>Note that the order of redirections is significant. For example, the command</p>
  <pre class="lang-sh prettyprint-override"><code>ls &gt; dirlist 2&gt;&amp;1
  </code></pre>
  <p>directs both standard output (file descriptor 1) and standard error (file descriptor 2) to the file dirlist, while the command</p>
  <pre class="lang-sh prettyprint-override"><code>ls 2&gt;&amp;1 &gt; dirlist
  </code></pre>
  <p>directs only the standard output to file dirlist, because the standard error was made a copy of the standard output before the standard output was redirected to dirlist.</p>
  </blockquote>
  <p>In the second case, if my understanding is correct, <code>2&gt;&amp;1</code> means everything in <code>stderr</code> will be redirected to <code>stdout</code> and <code>&gt; dirlist</code> means everything in <code>stdout</code> will be redirected to file <code>dirlist</code>. The final result is that only <code>stderr</code> is shown in the console.</p>
  <p>My question is that does such a phenomenon means the redirect of bash is not hierarchical? Since if it's hierarchical, the <code>stderr</code> has already been put into <code>stdout</code> and should be put into the file <code>dirlist</code> together with <code>stdout</code>.</p>