help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does {x..y} supposed to work?


From: Mike Jonkmans
Subject: Re: How does {x..y} supposed to work?
Date: Sat, 15 May 2021 00:33:53 +0200

On Fri, May 14, 2021 at 01:32:26PM -0400, Greg Wooledge wrote:
> On Fri, May 14, 2021 at 07:10:05PM +0200, Mike Jonkmans wrote:
> > On Thu, May 13, 2021 at 03:14:33PM -0400, Chet Ramey wrote:
> > > On 5/13/21 12:02 PM, Peng Yu wrote:
> > > > According to the manpage, x and y can be single characters. "the
> > > > expression expands to each character lexicographically between x and
> > > > y, inclusive".
> > > 
> > > Hmmmmm. So which would be better: "alphabetic character" or "letter"?
> > 
> > letter is better:
> > - it is shorter
> > - it rhymes 
> > 
> > Btw is this a posix restriction? It seems to be an unnecessary limitation.
> 
> POSIX does not specify brace expansion; it's a bash extension.

Aha, thx. My memories of using the Bourne shell are getting vague.

> Also, both letter and alphabetic character are factually inaccurate.
> A brace expansion may include non-alphabetic characters, as long as
> they aren't first or last in the sequence.

True.

But why not allow e.g. {!..~} ?
Though, using '{' or '}' as one of the 'single characters' could be problematic.
Oh well.

How about {\x..\y} does an escaped expansion?
E.g. {\Z..\a} expands to \Z \[ \\ \] \^ \_ \` \a
Or {'x'..'y'} expanding to 'x' ... 'y'

Then x, y could be anything from space to tilde.

Regards, Mike Jonkmans



reply via email to

[Prev in Thread] Current Thread [Next in Thread]