title: ls | grep -v in script
body: <p>I have a bash script where I want to do this</p>
  
  <pre><code>    (in pseudo)
      for each item in excludelist
          append to string: | grep -v $item
  
      for each file in directory 
      do
          stuff
      done
  </code></pre>
  
  <p>and now</p>
  
  <pre><code>   (in real code, the creation and concatenation of f works, the problem is not here I believe)
     for i in $EXCLUDE
     do
         echo $i
         f="$f | grep -v $i"
     done
  
     for d in `ls $AWSTATSCONF/awstats*conf $f`
     do
         echo $d
     done
  </code></pre>
  
  <p>output</p>
  
  <pre><code>   ls: |: No such file or directory
     ls: grep: No such file or directory
  </code></pre>
  
  <p>Any and all help really appreciated to get this to work.</p>
  
  <p>Greetings,</p>
  
  <p>Shadow</p>