when I try scp over zsh, I get

scp hostA:Descargas/debian-6.0.4-* user@
zsh: no matches found: hostA:Descargas/debian-6.0.4-*

the same command work in bash

  • Can you mark one of the answers as correct? Some look pretty good. – Geoff Oct 26 '13 at 20:16

Escape your wildcard :

scp hostA:Descargas/debian-6.0.4-\*
  • 1
    I got the same error when trying to run a ruby resque worker with the QUEUE=* option. Thanks for the fix! – mogramer Aug 29 '14 at 2:51
  • 2
    Thanks for solution... This seems like an example of zsh being too smart for its own good... – Owen Oct 13 '16 at 14:25
  • 1
    Worked for me as well. Weird though! – roopunk Jul 16 '17 at 6:39

or add this to your .zshrc

alias scp='noglob scp'

Unset the NOMATCH option so that zsh leaves the text alone instead of complaining about a glob failure.

  • 1
    Hi, how to unset that? in .zshrc ? – GoingMyWay Jun 8 '16 at 4:34

This post has a nice solution to this by using the url-quote-magic plugin to automatically escape globs in scp commands. To enable it, add the following to your ~/.zshrc:

# Automatically quote globs in URL and remote references
__remote_commands=(scp rsync)
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
zstyle -e :urlglobber url-other-schema '[[ $__remote_commands[(i)$words[1]] -le ${#__remote_commands} ]] && reply=("*") || reply=(http https ftp)'

When you type a glob character (like *) as part of a remote path in an scp or rsync command, zsh will automatically add a blackslash in front, like this:

scp hostA:Descargas/debian-6.0.4-\* user@
  • 1
    This is a nasty but nice trick. – Attila O. Nov 5 '13 at 1:22

Too late for the party, but..

You can escape the string with quotes too

scp "hostA:Descargas/debian-6.0.4-*" "user@"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.