title: Pipe a script into bash?
body: <p>Is there a difference between:</p>
  
  <pre><code>$ bash ~/script.sh
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>$ cat ~/script.sh | bash
  </code></pre>
  
  <p>They seem to behave slightly differently, and I can't quite figure out what is going on.  My <code>script.sh</code> contains several lines of bash, but it seems to abort early when I pipe it into bash (but runs to completion when I run the script directly).</p>
  
  <p>What's the difference in running the script in these two ways?</p>
  
  <p>Furthermore, when I use <code>&lt;</code>, the behavior is the same as the first example (runs to completion):</p>
  
  <pre><code>bash &lt;( ~/script.sh )
  </code></pre>
  
  <p>The script is along the lines of</p>
  
  <pre><code>set -eux
  ssh CLUSTER_0_SERVER_0 "do_something" || ssh CLUSTER_0_SERVER_1 "do_something"
  ssh CLUSTER_1_SERVER_0 "do_something" || ssh CLUSTER_1_SERVER_1 "do_something"
  </code></pre>