zsh-users
 help / color / mirror / code / Atom feed
* for loop question
@ 2014-11-02 20:47 Ray Andrews
  2014-11-02 21:00 ` Bart Schaefer
       [not found] ` <CAH+w=7aWS0xyS4CXRJBphDjesfUFQOsyJRMaG3RZRxmuj7xkOg__20885.3257158355$1414962125$gmane$org@mail.gmail.com>
  0 siblings, 2 replies; 19+ messages in thread
From: Ray Andrews @ 2014-11-02 20:47 UTC (permalink / raw)
  To: Zsh Users

test()
{

     # THIS WORKS  FINE:

     i=1
     while [ -n "$TLC[i]" ]; do
       let i=i+1
       print -ru2 $TLC[i]
     done

     # THIS WORKS FINE:

     for ((i=1; i<6; i++))
     do
       print -ru2 $TLC[i]
     done

     # ... BUT THIS FAILS WITH "BAD OUTPUT FORMAT SPECIFICATION":

     for ((i=1; [ -n "$TLC[i]" ]; i++))
     do
       print -ru2 $TLC[i]
     done
}

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?


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

end of thread, other threads:[~2014-11-04 16:57 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-02 20:47 for loop question Ray Andrews
2014-11-02 21:00 ` Bart Schaefer
     [not found] ` <CAH+w=7aWS0xyS4CXRJBphDjesfUFQOsyJRMaG3RZRxmuj7xkOg__20885.3257158355$1414962125$gmane$org@mail.gmail.com>
2014-11-02 21:37   ` Stephane Chazelas
2014-11-02 22:44     ` Ray Andrews
2014-11-02 22:57       ` Bart Schaefer
2014-11-02 23:24       ` Oliver Kiddle
2014-11-03  0:07         ` Ray Andrews
2014-11-03  1:53     ` Mikael Magnusson
2014-11-03  2:22       ` Ray Andrews
2014-11-03  9:22         ` Mikael Magnusson
2014-11-03 17:26           ` Ray Andrews
2014-11-04  1:56     ` Han Pingtian
2014-11-04  2:29       ` Han Pingtian
2014-11-04  2:43       ` Bart Schaefer
2014-11-04  4:51         ` Han Pingtian
2014-11-04  6:37         ` Ray Andrews
2014-11-04  7:13           ` Bart Schaefer
2014-11-04 18:00             ` Ray Andrews
     [not found]       ` <141103184338.ZM32221__48957.5251042426$1415069142$gmane$org@torch.brasslantern.com>
2014-11-04  7:08         ` Stephane Chazelas

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).