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

Re: counting in "for" loops



Phil Pennock <phil@xxxxxxxxxxxxxxxxxxxxx> typed:
:Typing away merrily, Geoff Wing produced the immortal words:
:> like and use it.  It's not as if there aren't a few choices.  For starters:
:Mostly just variants on a theme.  With the problem that they all look to
:produce:
:12345678910 (with no newline)

Yes, my mistake.  I blindly whacked -n on the echo.

:% ( local foo; set -A foo {1..10} ; print $foo )
:% ( local foo; print ${(A)foo::={1..10}} )
:Handle it, without the trailing space of another suggestion.
:I wanted:
:% print ${(A)_::={1..10}}
:which would nicely leave $_ with the values, but _ is a readonly
:variable.  *sigh*

Either way, you're not left with only one option.
-- 
Geoff Wing   <gcw@xxxxxxxxx>            Mobile : 0412 162 441
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/



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