On Thu, 12 Apr 2007, Karel Kulhavy wrote: > On Wed, Apr 11, 2007 at 10:02:50PM +0100, Stuart Henderson wrote: > > On 2007/04/11 13:41, Bryan Irvine wrote: > > > <snip> > > > >I agree, spaces in filenames should be avoided. But spaces in > > > >filenames are legal, so programs need to support that; this seems like > > > >a case scp was never tested against because no one uses files with > > > >those names. > > > > > > I scp'd a file called 'a b' to an openbsd server here, then scp'd it > > > back a couple time in different ways. It worked only when using the > > > quotes AND escaping, like so: > > > > > > scp [EMAIL PROTECTED]:"a\ b" . > > > > you have to escape to *both* your local shell, and the remote shell > > You must not escape to your local shell in case the scp process is called > directly by e. g. exec() function in C. > > If you have to escape to the remote shell, then it should be mentioned > in man scp. "escape" and "shell" don't occur in man scp and "remote" doesn't > occur in such a context there. > > If I wrote it, I would do it in a way that scp performed the escaping > for the remote shell automatically. Having to supply a different filename > depending on where the file is goes against the local-remote transparency > that scp is attempting at.
What you forget is that scp is implementing the same protocol that rcp uses. The protocol has a lot of shortcomings. See http://www.openssh.com/faq.html#2.10 But it looks like sftp has some problem with spaces in file names as well. ie, this fails: sftp remote:"/tmp/a b" . In interactive mode, I can specify get 'a b', that works. -Otto