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

Re: How to generate a list of numbers without 'seq'?



In the last episode (Mar 19), DervishD said:
>     Hi Clint :)
> 
>  * Clint Adams <clint@xxxxxxx> dixit:
> > >     print -l `seq 0 10`
> > >     entirely using Zsh. How can I replace the 'seq'???
> > print -l {0..10}
> 
>     This is more similar to the solution I was trying using <X-Y>,
> which doesn't seem to work if it cannot be expanded :( But IIRC, I've
> used <X-Y> syntax to generate list of numbers, but I don't remember
> how, when, etc.

<x-y> is pattern matching, so it only matches existing filenames;
{x..y} is parameter expansion so it generates its own values.  If you
have a LOT of numbers you want to generate, {x..y} will suck up memory,
so incrementing and printing a counter variable in a loop is better.

-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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