Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Zachary Santer
On Tue, Oct 17, 2023 at 5:56 PM Emanuele Torre wrote: > bash-5.1$ letters=( {a..z} ); echo "${letters["{10..15}"]}" > k l m n o p > Then there's the question "Was that even supposed to work like that?" If so, you'd think it would generalize to being able to pass a series of whitespace-de

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread alex xmb sw ratchev
On Wed, Oct 18, 2023, 14:20 Zachary Santer wrote: > On Tue, Oct 17, 2023 at 5:56 PM Emanuele Torre > wrote: > > > bash-5.1$ letters=( {a..z} ); echo "${letters["{10..15}"]}" > > k l m n o p > > > > Then there's the question "Was that even supposed to work like that?" If > so, you'd think

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Greg Wooledge
On Wed, Oct 18, 2023 at 08:19:35AM -0400, Zachary Santer wrote: > On Tue, Oct 17, 2023 at 5:56 PM Emanuele Torre > wrote: > > > bash-5.1$ letters=( {a..z} ); echo "${letters["{10..15}"]}" > > k l m n o p > > > > Then there's the question "Was that even supposed to work like that?" This

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Zachary Santer
On Wed, Oct 18, 2023 at 8:47 AM alex xmb sw ratchev wrote: > by chet stating many times that every bash item undergoes expansion .. > As in, Bash expands $ printf '%s\n' "${array["{2..6..2}"]}" to $ printf '%s\n' "${array[2]}" "${array[4]}" "${array[6]}" on its way to giving you two four six That

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Chet Ramey
On 10/17/23 5:55 PM, Emanuele Torre wrote: braces.c - brace_gobbler: use extract_dollar_brace_string if we see ${ with the appropriate value of QUOTING, so we don't have to teach brace expansion more shell syntax. Report from Emanuele Torre - brace_g

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Chet Ramey
On 10/18/23 9:39 AM, Zachary Santer wrote: I guess I still want to hear about "${#@}" and $[  ]. Sorry about bringing them up in relation to something that *is* documented. The former is unspecified, but seems reasonable: $@ expands the positional parameters to a set of words, and the # counts

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Greg Wooledge
On Wed, Oct 18, 2023 at 09:39:36AM -0400, Zachary Santer wrote: > I guess I still want to hear about "${#@}" and $[ ]. $[ ] is officially deprecated, and users are advised to stop using it. It was originally going to be the syntax for arithmetic expansion, and made it as far as some POSIX rough d

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Emanuele Torre
On Wed, Oct 18, 2023 at 09:50:00AM -0400, Chet Ramey wrote: > On 10/17/23 5:55 PM, Emanuele Torre wrote: > > > braces.c > > > - brace_gobbler: use extract_dollar_brace_string if we see ${ with > > > the appropriate value of QUOTING, so we don't have to teach brace > > > expansion more she

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Chet Ramey
On 10/18/23 10:24 AM, Emanuele Torre wrote: On Wed, Oct 18, 2023 at 09:50:00AM -0400, Chet Ramey wrote: On 10/17/23 5:55 PM, Emanuele Torre wrote: braces.c - brace_gobbler: use extract_dollar_brace_string if we see ${ with the appropriate value of QUOTING, so we don't have to

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Chet Ramey
On 10/18/23 10:50 AM, Chet Ramey wrote: Is it really ok to break that behaviour? That's why, if you want the first problem repaired, you have to specify which word expansions are ok to parse and which are not. Should it be only command and process substitution, which can independently specify

Re: bash tries to parse comsub in quoted PE pattern

2023-10-18 Thread Emanuele Torre
On Wed, Oct 18, 2023 at 11:24:11AM -0400, Chet Ramey wrote: > On 10/18/23 10:50 AM, Chet Ramey wrote: > > > > Is it really ok to break that behaviour? > > > > That's why, if you want the first problem repaired, you have to specify > > which word expansions are ok to parse and which are not. Shoul