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

Re: globbing in conditional expressions



On May 8, 10:19pm, Roman Neuhauser wrote:
}
} maybe a crazy idea...  how about something like [[ -m pattern ]] which
} would succeed iff pattern matched at least one path?  this could be
} somewhat more amenable to shortcircuiting.

Returning to this after a bit of a detour through [[ ... ]] expression
parsing:

You could define (via zmodload) an operator that applies filename
generation to its argument, but changes to the internals of globbing
would be needed to make a short-circuit happen.  Then those changes
would have to be exposed somehow so that the operator could use them.

As I mentioned before, in the case of the match failing this would be
exactly as expensive as not short-circuiting.



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