title: Pipe | Redirection < > Precedence
body: <p>I want to make clear when does pipe | or redirection &lt; > takes precedence in a command?</p>
  
  <p>This is my thought but need confirmation this is how it works.</p>
  
  <p>Example 1:</p>
  
  <pre><code>sort &lt; names | head
  The pipe runs first:  names|head   then it sorts what is returned from names|head
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>ls | sort &gt; out.txt
  This one seems straight forward by testing, ls|sort then redirects to out.txt
  </code></pre>
  
  <p>Example 3:</p>
  
  <pre><code>Fill in the blank?  Can you have both a &lt; and a &gt; with a | ???
  </code></pre>