Dennis Williamson wrote:
> Yes, do your quoting like this:
> ssh localhost 'bash -c "cd /tmp; pwd"'

I am a big fan of piping the script to the remote shell.

  $ echo "cd /tmp && pwd" | ssh example.com bash
  /tmp

This has two advantages.  One is that you can pick your shell on the
remote host.  Otherwise it runs as whatever is configured for that
user in the password file.  If the remote host has csh configured then
this overrides it and provides a known shell on the remote end.  Two
is that since this is stdin it avoids having two different shells
parse the command line.  Quoting is then much simplified.

Bob

Reply via email to