title: Mac Automator: shell script gets only one line
body: <p>I have an Automator script for a service that looks like this:</p>
  
  <pre><code>Receives as text in any application. Input is entire selection, does not replace selected text.
  -&gt; Run Shell Script (/bin/bash) "expand -t 4" pass input to stdin
  -&gt; Copy to Clipboard
  </code></pre>
  
  <p>No other options set. The idea is that I can select some code, and put a detabbed version in the clipboard without having to paste the code into BBEdit for detabbing.</p>
  
  <p>The service yields only the first line of the selected text. Deleting the shell-script action puts all of the selected text onto the clipboard. Running </p>
  
  <pre><code>expand -t 4 &lt; /path/to/tabbed.file &gt; result.file
  </code></pre>
  
  <p>yields the converted contents of the whole input file. Replacing the command with "wc" shows reasonable counts for lines, words, and characters.</p>
  
  <p>So the problem seems to be in passing a selection of more than one line into expand(1) by standard input from an Automator service's input. I don't see anything relevant from the expand(1) man page.</p>
  
  <p>What am I doing wrong?</p>