69

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.

slhck
  • 223,558
  • 70
  • 607
  • 592
Lynob
  • 5,240
  • 20
  • 60
  • 87
  • @Ramhound well switching to bash is not a big deal, but why switching to bash every time you want to download a video? besides i was working in virualenv switched to bash to try it and now my virtualenvwrapper is messed up, i need to uninstall it for it to work again http://stackoverflow.com/questions/11507186/python-virtualenv-no-module-named-virtualenvwrapper-hook-loader – Lynob Sep 24 '13 at 12:29
  • 1
    this command solved my issue: setopt +o nomatch Ref => https://unix.stackexchange.com/questions/310540/how-to-get-rid-of-no-match-found-when-running-rm – Paramesh Sep 09 '17 at 10:19

3 Answers3

127

Try quoting the URL, e.g.

youtube-dl '{video URL}'

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

Daniel Andersson
  • 23,895
  • 5
  • 57
  • 61
  • 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
  • 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 '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 03 '13 at 09:48
  • 3
    Quotes. I feel like an idiot.. – myol Jun 22 '16 at 18:03
17

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.

ubershmekel
  • 243
  • 2
  • 7
6

You can disable globbing for all commands with:

unsetopt nomatch

You can put it in ~/.zshrc.

Eyal Levin
  • 519
  • 5
  • 15