SSH quoting
I tend to do like this<p><pre><code>  ssh $server "echo $(cat script|base64 -w0) | base64 -d | bash"
</code></pre>
No scp, no quoting hell. Obviously there is other ways of doing it. And also if you run it with the base64 printed out it's possible to pass along and the user can still see what will be run.<p>I got good enough on escaping to really give up on it, the worst cases are just not worth the effort.