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 20), DervishD said:
> 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)?

It should work any time zsh does pattern matching:

  $ [[ 4 == <1-5> ]] && echo yes || echo no
  yes
  $ [[ 6 == <1-5> ]] && echo yes || echo no
  no

including case statements and ${var%%pattern} searches.

 
-- 
	Dan Nelson
	dnelson@xxxxxxxxxxxxxxx



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