Comment 13 for bug 89945

Revision history for this message
Björn Torkelsson (torkel) wrote :

If you run scp with the '-v' (verbose) you can see what command is actually run. It should be in the first line of output.

Without using any \ or " (or ') the filename are treated by the local shell as 3 arguments to scp instead of one; the filename.

In the first case the \ are expanded by the local shell and the result are passed to scp. I.e \\ becames a \ and '\ ' becames ' ', so the string that are passed to scp is actually 'testmachine:File\ with\ spaces', which are then expanded on the remote side, using the same rules.

In the second case the \ are not expanded by the local shell because of the ". The string (including \) are thus expanded on the remote side.

There is actually a third version you can use (at least for the moment):

scp testmachine:"'File with spaces'", i.e using both single and double quotes. The first pair is removed by the local shell and the second pair on the remote side.