title: Run shell script using fabric and piping script text to shell's stdin
body: <p>Is there a way to execute a multi-line shell script by piping it to the remote shell's standard input in <a href="http://fabfile.org" rel="noreferrer">fabric</a>? Or must I always write it to the remote filesystem, then run it, then delete it? I like sending to stdin as it avoids the temporary file. If there's no fabric API (and it seems like there is not based on my research), presumably I can just use the <code>ssh</code> module directly. Basically I wish <code>fabric.api.run</code> was not limited to a 1-line command that gets passed to the shell as a command line argument, but instead would take a full multi-line script and write it to the remote shell's standard input.</p>
  
  <p>To clarify I want the fabric equivalent of this command line:</p>
  
  <pre><code>ssh somehost /bin/sh &lt; /tmp/test.sh
  </code></pre>
  
  <p>Except in python the script source coude wouldn't come from a file on the local filesystem, it would just be a multiline string in memory. Note that this is a single logical operation and there is no temporary file on the remote side, meaning unexpected failures and crashes don't leave orphan files. If there were such an option in fabric (which is what I'm asking about), there would not need to be a temporary file on either side and this would only require a single ssh operation.</p>