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

Re: trivial syntax issue



On Wed 6 May 2026, at 16:04, Ray Andrews wrote:
> % [[ (zzz*(N)) ]] && echo TRUE
> TRUE
>
> ... I'd expect the 3d line to work as a naive simplification but it
> returns true every time.  Can it be fixed?

from zshmisc(1), conditional expressions:

  Filename generation is not performed on any form of argument to
  conditions. However, it can be forced in any case where normal shell
  expansion is valid and when the option EXTENDED_GLOB is in effect by
  using an explicit glob qualifier of the form (#q) at the end of the
  string. A normal glob qualifier expression may appear between the ‘q’
  and the closing parenthesis; if none appears the expression has no
  effect beyond causing filename generation. The results of filename
  generation are joined together to form a single word, as with the
  results of other forms of expansion.

iow, use [[ zzz*(#qN) ]] (the extra (...) are superfluous)

dana




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