From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16310 invoked by alias); 28 Mar 2015 23:25:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34808 Received: (qmail 13621 invoked from network); 28 Mar 2015 23:25:41 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,T_FSL_HELO_BARE_IP_2 autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1427584768; bh=WvPAEOC1SGHpLZtpNLlwlnKaCguS5nFyg0y1ivs23LA=; h=From:To:In-Reply-To:References:Subject:Date; b=DSe9StNm75o916LGQIP9qFMHUWoEV5GcLQqInDdtFRUZybT7quQ9EltzIOdDVm5T1 1oIB9bsSO0EwefpmT9jx+1lPk7Knyyix7RlqCPi0EHWlscYX7Mu/NkQjsdSP6huony gsmPsUVYpkcKsGO4BBNWQCkQmYGg7t3xYGOMPAFc= From: ZyX To: Eric Cook , "zsh-workers@zsh.org" In-Reply-To: <55173419.6070103@gmx.com> References: <55171842.7030505@gmx.com> <150328144428.ZM5583@torch.brasslantern.com> <55172355.80409@gmx.com> <150328152430.ZM18574@torch.brasslantern.com> <6862591427582011@web25h.yandex.ru> <55173419.6070103@gmx.com> Subject: Re: [[ is being treated as a pattern in the command/reserved word position. MIME-Version: 1.0 Message-Id: <6544501427584768@web10m.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Sun, 29 Mar 2015 02:19:28 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 29.03.2015, 02:07, "Eric Cook" : > On 03/28/2015 06:33 PM, ZyX wrote: >>  29.03.2015, 01:25, "Bart Schaefer" : >>>  On Mar 28,  5:55pm, Eric Cook wrote: >>>  } >>>  } % print $ZSH_PATCHLEVEL; emulate sh -c '[[ a == a ]]' >>>  } zsh-5.0.7-362-gab40656 >>>  } zsh: command not found: [[ >>>  } >>>  } Did that behavior change? >>> >>>  Aha.  That makes more sense. >>> >>>  The '[[' reserved word is handled a special kind of built-in alias [*] >>>  and the change to POSIX_ALIASES handling caused that to be disabled. >>> >>>  This will take a bit of thought. >>> >>>  [*] Not literally, but the alias expansion code is where '[[' is noted >>>  and the lexer changed into "parsing a conditional" state. >>  I would say that this is actually an expected behaviour: `posh -c '[[ a == a ]]'` will show `posh: [[: not found` because `[[` is not in POSIX. Similar error will be shown by dash. > > Nor is it disallowed by POSIXand it used to work, the bug report is > still valid. `[[` is a *syntax extension*. This *is* going against POSIX. If `[[` in POSIX emulation mode was implemented as a shell built-in in a manner that allows implementing it as a script your concern would be valid. But implementing `[[` as a shell built-in is breaking certain expectations about how `[[` is supposed to work. Specifically, with setopt SH_WORD_SPLIT w="a = b" test $w # False: a ≠ b, expected [[ a = b ]] # False: a ≠ b, expected [[ $w ]] # True: w is not empty, should be false if shell is POSIX . It is easier to disable `[[` then keep two implementations of it.