zsh-users
 help / color / mirror / code / Atom feed
* problem with zsh and wildcards in scp commands
@ 2013-03-17 10:46 John
  2013-03-17 12:33 ` Eike von Seggern
  0 siblings, 1 reply; 9+ messages in thread
From: John @ 2013-03-17 10:46 UTC (permalink / raw)
  To: zsh-users

I am using graysky's zsh config files which can be found on his github: https://github.com/graysky2/configs/tree/master/shell

When I try to scp wildcards from remote servers, I get errors:


% scp facade@gogo:~/*.xz .
zsh: no matches found: facade@gogo:~/*.xz

But if I do it without wildcards, no problems ...why :)

% scp facade@gogo:~/webcam.tar.xz .
webcam.tar.xz                                                                                 100%  928KB 464.1KB/s   00:02    


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 10:46 problem with zsh and wildcards in scp commands John
@ 2013-03-17 12:33 ` Eike von Seggern
  2013-03-18 13:47   ` Vincent Lefevre
  0 siblings, 1 reply; 9+ messages in thread
From: Eike von Seggern @ 2013-03-17 12:33 UTC (permalink / raw)
  To: zsh-users

Hi John,

you need to escape the *, e.g. by putting it into quotes:

scp "user@host:/path/to/*" .

Otherwise zsh tries to expand it on your local machine and fails, hence
the "zsh:…" message. Note that zsh's default behaviour differs here from
bash in that bash inserts a literal * if the glob-expansion failed while
zsh returns with the error you've encountered.

Best
Eike


On Sun, Mar 17, 2013 at 03:46 -0700, John wrote:
> I am using graysky's zsh config files which can be found on his github: https://github.com/graysky2/configs/tree/master/shell
> 
> When I try to scp wildcards from remote servers, I get errors:
> 
> 
> % scp facade@gogo:~/*.xz .
> zsh: no matches found: facade@gogo:~/*.xz
> 
> But if I do it without wildcards, no problems ...why :)
> 
> % scp facade@gogo:~/webcam.tar.xz .
> webcam.tar.xz                                                                                 100%  928KB 464.1KB/s   00:02    


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 12:33 ` Eike von Seggern
@ 2013-03-18 13:47   ` Vincent Lefevre
  0 siblings, 0 replies; 9+ messages in thread
From: Vincent Lefevre @ 2013-03-18 13:47 UTC (permalink / raw)
  To: zsh-users

On 2013-03-17 13:33:08 +0100, Eike von Seggern wrote:
> Hi John,
> 
> you need to escape the *, e.g. by putting it into quotes:
> 
> scp "user@host:/path/to/*" .
> 
> Otherwise zsh tries to expand it on your local machine and fails, hence
> the "zsh:…" message. Note that zsh's default behaviour differs here from
> bash in that bash inserts a literal * if the glob-expansion failed while
> zsh returns with the error you've encountered.

Concerning this behavior, zsh is more secure than POSIX shells such
as bash.

But to have * escaped automatically, url-quote-magic can be used.
See e.g.

  http://traviscj.com/tricks/?p=8
  http://superuser.com/questions/420525/scp-with-zsh-no-matches-found

and more generally:

  https://www.google.com/search?q=%22url-quote-magic%22+%22scp%22

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
@ 2013-03-17 19:21 John
  0 siblings, 0 replies; 9+ messages in thread
From: John @ 2013-03-17 19:21 UTC (permalink / raw)
  To: zsh-users

Thanks to everyone who replied to my thread.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 16:31     ` Jérémie Roquet
@ 2013-03-17 16:55       ` Valodim Skywalker
  0 siblings, 0 replies; 9+ messages in thread
From: Valodim Skywalker @ 2013-03-17 16:55 UTC (permalink / raw)
  To: Jérémie Roquet; +Cc: John, zsh-users

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

There is also setopt nonomatch to make globbing behave like it does in
bash, but you most certainly do not want that. Getting into the habit of
quoting where you don't want the shell to apply its expansions is a good
idea.

 - V


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 16:24   ` John
@ 2013-03-17 16:31     ` Jérémie Roquet
  2013-03-17 16:55       ` Valodim Skywalker
  0 siblings, 1 reply; 9+ messages in thread
From: Jérémie Roquet @ 2013-03-17 16:31 UTC (permalink / raw)
  To: John; +Cc: zsh-users

2013/3/17 John <da_audiophile@yahoo.com>:
> Thank you.  Perhaps an alias ?
>
> alias scp='noglob scp'

Keep in mind that it prevents local expansion for the whole line, so,
with this alias, you wouldn't be able to do things like “scp ./*.xz
facade@gogo:~/” anymore.

Best regards,

-- 
Jérémie


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 16:20 ` Jérémie Roquet
@ 2013-03-17 16:24   ` John
  2013-03-17 16:31     ` Jérémie Roquet
  0 siblings, 1 reply; 9+ messages in thread
From: John @ 2013-03-17 16:24 UTC (permalink / raw)
  To: Jérémie Roquet; +Cc: zsh-users

Thank you.  Perhaps an alias ?

alias scp='noglob scp'


----- Original Message -----
> From: Jérémie Roquet <arkanosis@gmail.com>
> To: John <da_audiophile@yahoo.com>
> Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
> Sent: Sunday, March 17, 2013 12:20 PM
> Subject: Re: problem with zsh and wildcards in scp commands
> 
> Hi,
> 
> 2013/3/17 John <da_audiophile@yahoo.com>:
>>  Thank you. Can zsh be modified easily in a config file to behave as bash 
> with scp?
> 
> unsetopt nomatch
> 
> I wouldn't advice to use this, however, as it still wouldn't do what
> you expect it to do if the expansion is possible locally.
> 
> You should rather use something like “noglob scp facade@gogo:~/*.xz
> .”, which prevents local expansion.
> 
> Best regards,
> 
> -- 
> Jérémie
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
  2013-03-17 16:03 John
@ 2013-03-17 16:20 ` Jérémie Roquet
  2013-03-17 16:24   ` John
  0 siblings, 1 reply; 9+ messages in thread
From: Jérémie Roquet @ 2013-03-17 16:20 UTC (permalink / raw)
  To: John; +Cc: zsh-users

Hi,

2013/3/17 John <da_audiophile@yahoo.com>:
> Thank you. Can zsh be modified easily in a config file to behave as bash with scp?

unsetopt nomatch

I wouldn't advice to use this, however, as it still wouldn't do what
you expect it to do if the expansion is possible locally.

You should rather use something like “noglob scp facade@gogo:~/*.xz
.”, which prevents local expansion.

Best regards,

-- 
Jérémie


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: problem with zsh and wildcards in scp commands
@ 2013-03-17 16:03 John
  2013-03-17 16:20 ` Jérémie Roquet
  0 siblings, 1 reply; 9+ messages in thread
From: John @ 2013-03-17 16:03 UTC (permalink / raw)
  To: zsh-users

Thank you. Can zsh be modified easily in a config file to behave as bash with scp?


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-03-18 13:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-17 10:46 problem with zsh and wildcards in scp commands John
2013-03-17 12:33 ` Eike von Seggern
2013-03-18 13:47   ` Vincent Lefevre
2013-03-17 16:03 John
2013-03-17 16:20 ` Jérémie Roquet
2013-03-17 16:24   ` John
2013-03-17 16:31     ` Jérémie Roquet
2013-03-17 16:55       ` Valodim Skywalker
2013-03-17 19:21 John

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).