0

I need to call an ssh command from a Windows command prompt that will execute a command on a remote Linux machine. The command accepts two string parameters, one of which can potentially be multi-lined. Basically, my call looks something like this:

ssh user@server command parameter1 parameter2

This fails miserably when there are spaces in the parameters. I've tried to escape the parameters with ', but those are stripped by the Windows box, and the Linux then mangles the parameters. I've tried also ", and those ok by the Windows box, but the Linux just ignores them. The version where I use both, like this

ssh user@server command "'para meter 1'" "'para meter 2'"

kinda-sorta works, but now I have the problem of in-line quotes. Is there any standard way that I would make both Linux and Windows understand both spaces, single and double quotes?

1 Answer 1

0

I would imagine that the following would work quite well:

ssh user@server "command \"parameter 1\" \"parameter 2\""

Of course, then you still have the problem of needing to double-escape the double quotes inside your parameters.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .