Re: bash tries to parse comsub in quoted PE pattern

2023-10-22 Thread Martin D Kealey
On Wed, 18 Oct 2023 at 22:19, 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 > ... > So how important is it to maintain undocumented behavior? > This is the expected outco

Re: bash tries to parse comsub in quoted PE pattern

2023-10-21 Thread Emanuele Torre
On Thu, Oct 19, 2023 at 04:12:16PM -0400, Chet Ramey wrote: > On 10/18/23 1:08 PM, Emanuele Torre wrote: > > While we are at it, when examining this issue now, I have also noticed > > that, regardless of whether brace expansion is enabled or not, the bash > > parser always reads single quotes in do

Re: bash tries to parse comsub in quoted PE pattern

2023-10-19 Thread Chet Ramey
On 10/18/23 1:08 PM, Emanuele Torre wrote: 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 pars

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

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 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 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 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 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 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 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 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 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 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-17 Thread Emanuele Torre
> 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_gobbler: call the word extraction functions

Re: bash tries to parse comsub in quoted PE pattern

2023-10-13 Thread Chet Ramey
On 10/13/23 12:08 PM, Emanuele Torre wrote: In a PE pattern, if the pattern has a single quoted part that contains $( and does not contain a closing parenthesis, and has \' at the end, bash will try to parse a command substitution and fail. This is brace expansion. It looks like I'll have

bash tries to parse comsub in quoted PE pattern

2023-10-13 Thread Emanuele Torre
In a PE pattern, if the pattern has a single quoted part that contains $( and does not contain a closing parenthesis, and has \' at the end, bash will try to parse a command substitution and fail. $ echo "${HOME#'$('\'}" bash: command substitution: line 3: unexpected EOF while looking