Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Issue: Handling of globbing fails

On Mon, 12 Feb 2018 17:34:11 +0100
Šimon Let <simon.a.let@xxxxxxxxx> wrote:
> Consider running following command:
> `echo some_empty_directory/* && echo "NO FAIL" || echo "FAIL"`
> It produces following output:
> `zsh: no matches found: some_empty_dir/*`

Yes, it's an error, and is documented as such.  Please read the
documentation for 'filename generation' and in particular the second
paragraph below where you'll also see how to modify it.

Shells have this sort of thing hard coded at a low level and have done
for a long time --- they can be counter-intuitive but I'm afraid reading
up about the subject is the only fix.  We can recommend some "light"
reading on the subject, if you like...

       If  a  word contains an unquoted instance of one of the characters `*',
       `(', `|', `<', `[', or `?', it is regarded as a  pattern  for  filename
       generation,  unless  the  GLOB  option  is unset.  If the EXTENDED_GLOB
       option is set, the `^' and `#' characters also denote a pattern; other‐
       wise they are not treated specially by the shell.

       The  word  is  replaced  with a list of sorted filenames that match the
       pattern.  If no matching pattern is found, the  shell  gives  an  error
       message,  unless the NULL_GLOB option is set, in which case the word is
       deleted; or unless the NOMATCH option is unset, in which case the  word
       is left unchanged.


Messages sorted by: Reverse Date, Date, Thread, Author