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

Re: for loop question



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?




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