73

I downloaded youtube-dl using pip on CrunchBang (a Debian Wheezy distro). When I run

youtube-dl {video URL}

I get

zsh: no matches found: {video URL}

I guess it has something to do with zsh, because I found some users on Arch forums complaining about it. When I switched to bash it worked.

2

3 Answers 3

139

Try quoting the URL, e.g.

youtube-dl '{video URL}'

in your notation, to avoid possible interpretation of special characters in the string.

5
  • why no one mention that? it works, i will accept it in 6 minutes, the system doesn't let me accept it right away
    – Lynob
    Sep 24, 2013 at 12:31
  • 3
    @Fischer By the way: my Zsh (on OS X in iTerm2 with oh-my-zsh) automatically escapes shell-specific characters like & and !, so there might be an option to configure that.
    – slhck
    Sep 24, 2013 at 12:49
  • @slhck i just tried it on xterm doesn't work, i don't have xterm2, i'm using oh-my-zsh too.. yes i guess i have to configure my zsh for that, i guess bash does it by default because i haven't configured it, still using the default configuration
    – Lynob
    Sep 24, 2013 at 16:59
  • 2
    @Fischer: You'll need to load the url-quote-magic funtion to get special shellcharacters to be quotes automatically in URLs: autoload -Uz url-quote-magic; zle -N self-insert url-quote-magic
    – mpy
    Oct 3, 2013 at 9:48
  • 3
    Quotes. I feel like an idiot..
    – myol
    Jun 22, 2016 at 18:03
18

This was already mentioned in the comments, but it deserves its own answer:

autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic

autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic

This causes pasted URLs to be automatically quoted, without needing to disable globbing.

Place the above snippet in your ~/.zshrc file to persist this setting for future terminal sessions.

0
6

You can disable globbing for all commands with:

unsetopt nomatch

You can put it in ~/.zshrc.

2
  • Shouldn't that be setopt nomatch?
    – Tom Hale
    Sep 28, 2020 at 5:30
  • @TomHale no, because nomatch is the setting that causes errors on unmatched patterns. Disabling it can also be done with no_nomatch.
    – detuur
    Nov 10, 2021 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .