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

Re: [BUG] Cannot use (#i) flag in [[ ]] explicit glib



On Tue, Sep 10, 2019 at 7:50 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> if [[ -f (#i)$dir/README.md(#qN[1]) ]]; then echo true; fi
>
> Output:
> zsh: parse error near `('

That's not exactly a bug, it's because a parenthesized sub-expression
is valid syntax inside [[ ]].  The parser can't tell why the open
paren is there.  It might be possible to special-case the operators
that accept file patterns as arguments, but right now except for "-t"
(which has special handling for ksh compatibility) the parser doesn't
use any such context dependence; that is, the operators are not
tokens, they're just one in a list of strings, a property which is
made use of by the module system for defining new condition operators.



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