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

Re: RFE: Brace expansion with single characters



On Wed, 08 Jan 2014 10:55:05 +0100
Jerry Rocteur <jerry.rocteur@xxxxxxxxx> wrote:
> echo {0..12}
> 
> Does what is expected
> 
> echo {a..z}
> 
> Does nothing as expected
> 
> setopt braceccl
> echo {a-z}
> 
> does something somebody expected ?

Yes, that's how zsh works; OK so far...

> Shouldn't there be some kind of uniformity or is this for a reason ?

I'm not sure what you mean.  Bash and zsh have different extensions.
Are you saying "should they have the same set of extensions"?  Not
particularly, no.  They copy each other to some extent but also go
their own way to some exstent.  The history is something like:

- zsh invented the BRACECCL option (this has been there for donkey's
years) which expands everything in the brace as a single character (even
if the character is repeated in the base), except that "-" is a special
case to indicate a range.  This is rather different from the feature
required --- it makes braces without commas do rather more than you
expect, as noted by Vincent.   That's not a bug, however; its
significant additional effect is why it's an option.

- zsh invented the {<integer>..<integer>} syntax (vaguely inspired by
Perl).  This isn't an option because it's specific enough not to cause
problems.

- bash also started using that syntax, but added the extra feature
with single character ranges.

> The other two shells work as expected.

As far as I can see, and as your comments at the top suggest, everything
works as expected.  Are you saying both bash and zsh currently work as
documented?  I think that's correct.  The original post was simply a
request for a new feature.

It looks fairly straightforward to add the bash feature to zsh in this
case and I've just been looking at it.  I would imagine this will fit
in naturally enough not to cause complications.

pws



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