[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does {x..y} supposed to work?
From: |
Dennis Williamson |
Subject: |
Re: How does {x..y} supposed to work? |
Date: |
Fri, 14 May 2021 17:59:56 -0500 |
On Fri, May 14, 2021, 5:35 PM Mike Jonkmans <bashbug@jonkmans.nl> wrote:
> 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
>
chr ()
{
local c;
for c in "$@";
do
printf "\\$(($c/64*100+$c%64/8*10+$c%8)) ";
done
}
$ chr {51..65}; echo
3 4 5 6 7 8 9 : ; < = > ? @ A
>
Re: How does {x..y} supposed to work?, Reuti, 2021/05/13
Re: How does {x..y} supposed to work?, Chet Ramey, 2021/05/13
- Re: How does {x..y} supposed to work?, Mike Jonkmans, 2021/05/14
- Re: How does {x..y} supposed to work?, Greg Wooledge, 2021/05/14
- Re: How does {x..y} supposed to work?, Lawrence Velázquez, 2021/05/14
- Re: How does {x..y} supposed to work?, Chet Ramey, 2021/05/14
- Re: How does {x..y} supposed to work?, Mike Jonkmans, 2021/05/14
- Re: How does {x..y} supposed to work?,
Dennis Williamson <=
- Re: How does {x..y} supposed to work?, Greg Wooledge, 2021/05/14
- Re: How does {x..y} supposed to work?, Dennis Williamson, 2021/05/14
Re: How does {x..y} supposed to work?, Chet Ramey, 2021/05/16
Re: How does {x..y} supposed to work?, Alex fxmbsw7 Ratchev, 2021/05/17
Re: How does {x..y} supposed to work?, Peng Yu, 2021/05/17
Re: How does {x..y} supposed to work?, Chet Ramey, 2021/05/14