title: Why does variable expansion within an alias work "as intended" in only one of these cases?
body: <p>This question was inspired in part by <a href="https://stackoverflow.com/questions/4438147/alias-with-variable-in-bash">this one</a>.</p>
  
  <pre><code>alias foo='ls -1 $1'
  foo /etc
  </code></pre>
  
  <p>displays the contents of /etc, one item per line.</p>
  
  <pre><code>ls -1 /etc | tail
  </code></pre>
  
  <p>displays the last ten items in /etc.</p>
  
  <p>But</p>
  
  <pre><code>alias foo='ls -1 $1 | tail'
  foo /etc
  </code></pre>
  
  <p>displays: tail: error reading `/etc': Is a directory</p>