From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17190 invoked by alias); 18 Oct 2013 19:20:17 -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: 31845 Received: (qmail 18516 invoked from network); 18 Oct 2013 19:20:02 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131018122000.ZM9018@torch.brasslantern.com> Date: Fri, 18 Oct 2013 12:20:00 -0700 In-reply-to: <20131018165614.48f399b7@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: zsh syntax check fails on correct if [[ usage (rhbz 966911)" (Oct 18, 4:56pm) References: <52613F82.1000009@redhat.com> <131018084831.ZM8783@torch.brasslantern.com> <20131018165614.48f399b7@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 18, 4:56pm, Peter Stephenson wrote: } Subject: Re: zsh syntax check fails on correct if [[ usage (rhbz 966911) } } On Fri, 18 Oct 2013 08:48:31 -0700 } Bart Schaefer wrote: } > If you run the test as } > } > zsh -vxn /tmp/test.zsh } > } > it becomes clear that zsh is actually executing some of the commands, } > and then returning the exit status of those commands rather than of } > the syntax check itself. } } It's certainly forking, and I think it's peforming the assignments, and } it seems to perform the test. The problem here is we don't actually } have a syntax checking mode, we just have a mode that tries to execute } as little as possible. As little as possible isn't a very clear target. Well, yeah, but it's really strange that in some cases it executes NOTHING, and in other very similar cases it executes the tests and assignments, and it's really not obvious why there's a difference. Compare these three commands: Src/zsh -fvxnc 'if [[ $# -gt 0 ]]; then :; X=$1; fi' Src/zsh -fvxnc 'if [[ $# -gt 0 ]]; then X=$1; fi' Src/zsh -fvxnc 'if [ $# -gt 0 ]; then X=$1; fi' Why does the inclusion of the ":" in the first case cause the execution of the test to be skipped? Why does the use of [[ ]] in place of [ ] cause the test to be executed? Additionally: Why doesn't -v result in any output when used with -c ? If you put any of the above one-liners in a file and executed it as a script, it gets printed as verbose output.