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

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



    Hi Dan :)

 * Dan Nelson <dnelson@xxxxxxxxxxxxxxx> dixit:
> > > 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;

    Is there a way of making it work in string environment or
something like that (a mechanism similar to the use of globbing flags
in pattern matching at parameter expansion)?

> {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.

    So for general use, when you don't know in advance how many
numbers you want to generate, is better to use the variable in a
loop.

    Thanks for the information :))

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/



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