title: Pipe with `tee` in a `for` loop
body: <p>This is probably a newbie's escaping problem.  I'm trying run command in a for loop like this</p>
  
  <pre><code>$ for SET in `ls ../../mybook/WS/wsc_production/`; do ~/sandbox/scripts/ftype-switch/typesort.pl /media/mybook/WS/wsc_production/$SET ./wsc_sorter/$SET | tee -a sorter.log; done;
  </code></pre>
  
  <p>but I end up with <code>sorter.log</code> being empty. (I'm sure there <em>is</em> some output.)  If I escape the pipe symbol (<code>\|</code>), I end up with no <code>sorter.log</code> at all.</p>
  
  <p>What am I doing wrong?</p>
  
  <pre><code>$ bash --version
  GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)
  </code></pre>
  
  <p><strong>Edit:</strong> Oops, /media/mybook/ fell asleep, so there actually <em>was no output</em>. The code was correct in the first place. Thanks to all for comments, though.</p>