zsh-workers
 help / color / mirror / code / Atom feed
* Issue: Handling of globbing fails
@ 2018-02-12 16:34 ` Šimon Let
  2018-02-12 17:03   ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Šimon Let @ 2018-02-12 16:34 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

Hi,
I want to create an issue.


The way zsh handles globbing fails is non-systematic.

Consider running following command:

`echo some_empty_directory/* && echo "NO FAIL" || echo "FAIL"`

It produces following output:

`zsh: no matches found: some_empty_dir/*`

The command causes globbing fail but the way zsh handles this fail is
beyond me.
Why does globbing fail stop execution of the current line (or script)?

This behavior is non-systematic or surprising at least.
Why does failed globbing behave almost as a parsing error?


Cheers,

Simon Let

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Issue: Handling of globbing fails
  2018-02-12 16:34 ` Issue: Handling of globbing fails Šimon Let
@ 2018-02-12 17:03   ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2018-02-12 17:03 UTC (permalink / raw)
  To: Šimon Let, zsh-workers

On Mon, 12 Feb 2018 17:34:11 +0100
Šimon Let <simon.a.let@gmail.com> 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...


FILENAME GENERATION
       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.


pws


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-12 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180212163514epcas5p34a9c8c3dd91cc702e72871cb009648ef@epcas5p3.samsung.com>
2018-02-12 16:34 ` Issue: Handling of globbing fails Šimon Let
2018-02-12 17:03   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).