zsh-workers
 help / Atom feed
* [BUG] Cannot use (#i) flag in [[ ]] explicit glib
@ 2019-09-11  2:49 Sebastian Gniazdowski
  2019-09-11 20:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2019-09-11  2:49 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
if [[ -f (#i)$dir/README.md(#qN[1]) ]]; then echo true; fi

Output:
zsh: parse error near `('

A workaround is to precede with '', i.e.:

if [[ -f ''(#i)$dir/README.md(#qN[1]) ]]; then echo true; fi

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: [BUG] Cannot use (#i) flag in [[ ]] explicit glib
  2019-09-11  2:49 [BUG] Cannot use (#i) flag in [[ ]] explicit glib Sebastian Gniazdowski
@ 2019-09-11 20:11 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2019-09-11 20:11 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Tue, Sep 10, 2019 at 7:50 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> 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.

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  2:49 [BUG] Cannot use (#i) flag in [[ ]] explicit glib Sebastian Gniazdowski
2019-09-11 20:11 ` Bart Schaefer

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox