Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   scp escape characters (http://www.linux-archive.org/gentoo-user/70739-scp-escape-characters.html)

Mick 04-16-2008 02:06 PM

scp escape characters
 
Hi All,

I was trying to scp a file which had spaces in its name; e.g.

This is the name of it.txt

But scp would fail each time saying that the name is ambiguous (or
something similar). I also tried enclosing the name in 'single', or
"double" quotes, but it wouldn't have any.

What's the right way of doing this?

Both boxen running gentoo and I was using bash shell.
--
Regards,
Mick
--
gentoo-user@lists.gentoo.org mailing list

Michal 'vorner' Vaner 04-16-2008 02:10 PM

scp escape characters
 
Hello

On Wed, Apr 16, 2008 at 03:06:05PM +0100, Mick wrote:
> Hi All,
>
> I was trying to scp a file which had spaces in its name; e.g.
>
> This is the name of it.txt

There is a problem ‒ it unescapes at both ends, so you need to
double-escape it, like

'Filename with spaces'

or

Filename with spaces.

Or, something like that (if I see it right).

--
Support your right to arm bears!!

Michal 'vorner' Vaner

04-16-2008 02:12 PM

scp escape characters
 
Am Mittwoch, den 16.04.2008, 15:06 +0100 schrieb ext Mick:

> I was trying to scp a file which had spaces in its name; e.g.
>
> This is the name of it.txt
>
> But scp would fail each time saying that the name is ambiguous (or
> something similar). I also tried enclosing the name in 'single', or
> "double" quotes, but it wouldn't have any.
>
> What's the right way of doing this?
>
> Both boxen running gentoo and I was using bash shell.

I tried it in my zsh, with TAB-completion (means: I typed "scp
remote_host:~/Fil<tab>"), and it gives this:

scp remote_host:~/File with blanks

And, of course, it copies the file just fine :-)

HTH...

Dirk
--
Dirk Heinrichs | Tel: +49 (0)162 234 3408
Configuration Manager | Fax: +49 (0)211 47068 111
Capgemini Deutschland | Mail: dirk.heinrichs@capgemini.com
Wanheimerstraße 68 | Web: http://www.capgemini.com
D-40468 Düsseldorf | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net

Mick 04-16-2008 02:29 PM

scp escape characters
 
On 16/04/2008, dirk.heinrichs.ext@nsn.com <dirk.heinrichs.ext@nsn.com> wrote:
> Am Mittwoch, den 16.04.2008, 15:06 +0100 schrieb ext Mick:
>
>
> > I was trying to scp a file which had spaces in its name; e.g.
> >
> > This is the name of it.txt

> I tried it in my zsh, with TAB-completion (means: I typed "scp
> remote_host:~/Fil<tab>"), and it gives this:
>
> scp remote_host:~/File with blanks
>
> And, of course, it copies the file just fine :-)

Thanks guys, I'll try it next time. Just one thing: if the spaces
need to be escaped at both ends, shouldn't it have just 2 , why are
you showing it with 3 ?
--
Regards,
Mick
--
gentoo-user@lists.gentoo.org mailing list

Etaoin Shrdlu 04-16-2008 02:31 PM

scp escape characters
 
On Wednesday 16 April 2008, 16:06, Mick wrote:
> Hi All,
>
> I was trying to scp a file which had spaces in its name; e.g.
>
> This is the name of it.txt
>
> But scp would fail each time saying that the name is ambiguous (or
> something similar). I also tried enclosing the name in 'single', or
> "double" quotes, but it wouldn't have any.
>
> What's the right way of doing this?
>
> Both boxen running gentoo and I was using bash shell.

Either

$ scp 'This is the name of it.txt' user@remote:/dst/dir

or

$ scp user@remote:'/src/dir/This is the name of it.txt' /dst/dir

depending on who's local and who's remote, should work.

If neither does, post the actual command you were using.

PS: Of course, if only that file begins with that characters, you can
cheat and do

$ scp user@remote:/src/dir/This* /dst/dir
--
gentoo-user@lists.gentoo.org mailing list

Etaoin Shrdlu 04-16-2008 02:46 PM

scp escape characters
 
On Wednesday 16 April 2008, 16:31, Etaoin Shrdlu wrote:

> $ scp user@remote:'/src/dir/This is the name of it.txt' /dst/dir

Wrong (sorry). You need to both quote and escape spaces.
--
gentoo-user@lists.gentoo.org mailing list

Mike Edenfield 04-16-2008 02:50 PM

scp escape characters
 
Mick wrote:

On 16/04/2008, dirk.heinrichs.ext@nsn.com <dirk.heinrichs.ext@nsn.com> wrote:

Am Mittwoch, den 16.04.2008, 15:06 +0100 schrieb ext Mick:


> I was trying to scp a file which had spaces in its name; e.g.
>
> This is the name of it.txt



I tried it in my zsh, with TAB-completion (means: I typed "scp
remote_host:~/Fil<tab>"), and it gives this:

scp remote_host:~/File with blanks

And, of course, it copies the file just fine :-)


Thanks guys, I'll try it next time. Just one thing: if the spaces
need to be escaped at both ends, shouldn't it have just 2 , why are
you showing it with 3 ?


It's escaping the first slash and the space:

' ' -> ' ' -> ' '

--K

--
gentoo-user@lists.gentoo.org mailing list


All times are GMT. The time now is 01:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.