From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2846 invoked by alias); 4 Nov 2014 02:07:04 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19321 Received: (qmail 23535 invoked from network); 4 Nov 2014 02:06:53 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.2 Date: Tue, 4 Nov 2014 09:56:39 +0800 From: Han Pingtian To: zsh-users@zsh.org Cc: Bart Schaefer , Ray Andrews Subject: Re: for loop question Message-ID: <20141104015639.GA2871@localhost.localdomain> Mail-Followup-To: zsh-users@zsh.org, Bart Schaefer , Ray Andrews References: <5456984A.3020001@eastlink.ca> <20141102213713.GA4412@chaz.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141102213713.GA4412@chaz.gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14110401-0017-0000-0000-0000060945AD On Sun, Nov 02, 2014 at 09:37:13PM +0000, Stephane Chazelas wrote: > 2014-11-02 13:00:14 -0800, Bart Schaefer: > > > I've fiddled around with various modifications but it seems to dislike " > > [ -n "$TLC[i]" ] " > > > even though the 'while' loop is happy with it. That expression evaluates > > to true or > > > false, does it not? So why won't 'for' swallow it? > > > > The double parents (( )) are special arithmetic syntax. You can't use an > > ordinary shell command like "test" ( for which "[" is an alias) inside that > > construct. > > You could with: > > for ((i=1; (z[$([ -n "$TLC[i]" ])0]),$? == 0; i++)) > print -ru2 -- $TLC[i] > What does the (z[$([ -n "$TLC[i]" ])0]) mean, please?