title: How can I get xargs to do something with the input, then do another thing?
body: <p>I'm in zsh.</p>
  
  <p>I'd like to do something like:</p>
  
  <p><code>find . -iname *.md | xargs cat &amp;&amp; echo "---" &gt; all_slides_with_separators_in_between.md</code></p>
  
  <p>Of course this cats all the slides, then appends a single "---" at the end instead of after each slide.</p>
  
  <p>Is there an xargs way of doing this? Can I replace <code>cat &amp;&amp; echo "---"</code> with some inline function or <code>do</code> block? </p>
  
  <p><hr/>
  Very strangely, when I create a file <code>cat---.sh</code> with the contents</p>
  
  <pre><code>cat $1
  echo ---
  </code></pre>
  
  <p>and run </p>
  
  <p><code>find . -iname *.md | xargs ./cat---.sh</code></p>
  
  <p>it only executes for the first result of find.<br>
  Replace cat---.sh with cat and it runs on both files. </p>