Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: globbing in conditional expressions
Bart Schaefer wrote on Wed, May 14, 2014 at 00:18:19 -0700:
> Do I read correctly that "shortcircuit" also means "don't return any
> file names, just return an indication of whether there is such a file"
> ?? (Since you don't allocate the matchbuf array when shortcircuit.)
>
Of course. As soon as you find a single matching filename you return to
the caller, so there are two options: either return just a boolean, or
return the first matching filename in readdir() order (via $REPLY, as in
Roman's post). I'm not sure how idiomatic it would be for a [[ -x ]]
condition to set $REPLY.
> If so, there might be a more descriptive name for it, "search_only"
> or something.
I don't really how it's called. Some more options are "list_matches"
(default TRUE) or "boolean_context" (default FALSE). I'm fine with any
choice.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author