33

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.

57

Try quoting the URL, e.g.

youtube-dl '{video URL}'

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

  • 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 '13 at 12:31
  • 2
    @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 '13 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 '13 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 '13 at 9:48
  • 2
    Quotes. I feel like an idiot.. – myol Jun 22 '16 at 18:03
9

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.

  • Oops, it does work. My bad! – Lenar Hoyt Sep 18 '17 at 23:39
2

You can disable globbing for all commands with:

unsetopt nomatch

You can put it in ~/.zshrc.

  • Shouldn't that be setopt nomatch? – Tom Hale Sep 28 '20 at 5:30

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.