Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently switched to zsh. In bash, when I use "ls --hide=*.pyc" in a file with no .pyc files, ls works as expected. In zsh, "ls --hide=*.pyc" works when the directory contains .pyc files, but fails with zsh: no matches found: --hide=*.pyc when no matches are found.

I would like to alias ls as "ls --hide=*.pyc"; is it possible to get zsh to stop complaining when no matches are found?

Thank you.

share|improve this question
You should really be escaping or quoting that asterisk. If you happened to have a directory entry like --hide=something.pyc (admittedly unlikely), then even bash would no do what you expect. Using ls --hide=\*.pyc or ls --hide='*.pyc' will work in all sane shells (since no wildcard actually is involved). – Chris Johnsen Feb 2 '10 at 1:33
up vote 6 down vote accepted

Try doing unsetopt nomatch.

share|improve this answer

Quote the filespec:

ls --hide="*.pyc"

alias lh='ls --hide="*.pyc"'
share|improve this answer

You must log in to answer this question.

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