On Thu, Apr 12, 2007 at 04:05:36AM +0200, Karel Kulhavy wrote:

> scp needs one (1) \ for one space in case of remote file and zero (0) \ in 
> case
> of local one. The extra \'s are for bash but bash is irrelevant in this case.
> It's just one possible method of calling the process. Another method is
> writing a small C program and using exec.

  people aren't being specific enough when they're talking about this but
  it seems most people are trying to say the same thing.

  the moral of the story is that the shells in question have to not
  split on the space but treat it as a character of the filename.

  so you either quote it or escape it

  both shells need that.

  these all work:

$ scp "a b" remotehost:
$ scp a\ b remotehost:
$ scp remotehost:"a\ b" .
$ scp remotehost:\"a\ b\" .

  you can only say that 'zero (0) \ in case of local [file]' (per space)
  *if* you do use quotes locally.

  it is more specific to say you use one backslash or quotepair per space
  per shell.

  example 3 has the local shell eating the quotes and passing the backslash
  along so the remote shell escapes the space.

  example 4 has local shell eating the backslash escaping the space
  and the remote shell gets the quoted string. 

  just remember that and you don't have any problems any more.

-- 

  jared

Reply via email to