Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Lawrence Velázquez
> On Feb 17, 2021, at 10:27 PM, Dale R. Worley wrote: > > Lawrence Velázquez writes: `;;' is optional for the last case item. >>> >>> The manual page (for my version) says it's required. If, in some >>> certain circumstances, it works without, that's nice. >> >> It's also required by POSI

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Dale R. Worley
Lawrence Velázquez writes: >>> `;;' is optional for the last case item. >> >> The manual page (for my version) says it's required. If, in some >> certain circumstances, it works without, that's nice. > > It's also required by POSIX. Ah, now that's different. Has the current man page been update

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Koichi Murase
2021年2月18日(木) 7:43 Robert Elz : > From scratch, no, but I maintain one. > > With all the details > > It isn't all that hard, but isn't trivial > either, and amounts to quite a bit of code > (and parsing all the bash extensions the > way it does would make it harder and bigger) > > Like everythi

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Robert Elz
Date:Thu, 18 Feb 2021 01:34:59 +0800 From:Koichi Murase Message-ID: | ever written a shell parser? From scratch, no, but I maintain one. With all the details It isn't all that hard, but isn't trivial either, and amounts to quite a bit of code (and parsing a

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Koichi Murase
2021年2月18日(木) 0:56 Robert Elz : > For a long time [...] > > [...] And it all has to be recursive, > as $() cmdsubs can occur in the middle of words in the middle of other > cndsubs. Thank you for the historical story. > Chet can explain more if he feels it is warranted, but I believe that even

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Chet Ramey
On 2/17/21 11:56 AM, Robert Elz wrote: Chet can explain more if he feels it is warranted, but I believe that even today, bash uses a very heuristic type of almost pretend to be a parser to deal with these things - not really parsing them fully (not until they're to be executed, where the issues

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Chet Ramey
On 2/17/21 9:53 AM, Oğuz wrote: 16 Şubat 2021 Salı tarihinde Chet Ramey > yazdı: This is just academic. No sane person would write these without some kind of delimiter. Yeah, `parse_comsub' really needs some work anyway. Don't worry. -- ``The lyf so shor

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Robert Elz
Date:Wed, 17 Feb 2021 23:39:07 +0800 From:Koichi Murase Message-ID: Andreas answered the technical part of your message, and I agree with that. | Anyway, even if the POSIX specifies some inconsistent grammar, I feel | that cannot be the reason that Bash behaves

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Oğuz
17 Şubat 2021 Çarşamba tarihinde Koichi Murase yazdı: > 2021年2月17日(水) 1:52 Oğuz : > > They resemble `[ ... ]' (I know it's a simple command, but still), maybe > that's why. I think it'd seem more inconsistent to ordinary user if > > > > if [[ x ]] then [[ x ]] fi > > > > worked but > > > > if

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Andreas Schwab
On Feb 17 2021, Koichi Murase wrote: > Yes, that's what I wanted to claim by the above example, that is, XCU > 2.4 isn't the (most) essential point for the reason that `fi esac' or > `fi fi` is a valid construct. The above example is just a > counter-example against explaining `fi esac` by solely

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Koichi Murase
2021年2月17日(水) 1:52 Oğuz : > They resemble `[ ... ]' (I know it's a simple command, but still), maybe > that's why. I think it'd seem more inconsistent to ordinary user if > > if [[ x ]] then [[ x ]] fi > > worked but > > if [ x ] then [ x ] fi > > didn't. ``Ordinary users'' may consider it be

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Koichi Murase
2021年2月17日(水) 21:56 Robert Elz : > | For example, this alone doesn't explain why > | > | $ if :; then echo A; fi if :; then echo A; fi > | > | (i.e., the combination "fi if") is a syntax error. > > That one is quite a different issue, Yes, that's what I wanted to claim by the above examp

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Oğuz
16 Şubat 2021 Salı tarihinde Chet Ramey yazdı: > > This is just academic. No sane person would write these without some kind > of delimiter. > Yeah, `parse_comsub' really needs some work anyway. $ ./bash -c '$(case x in x|esac) foo;; esac)' ./bash: -c: line 1: syntax error near unexpected to

Re: syntax error while parsing a case command within `$(...)'

2021-02-17 Thread Robert Elz
Date:Tue, 16 Feb 2021 18:19:48 +0800 From:Koichi Murase Message-ID: | For example, this alone doesn't explain why | | $ if :; then echo A; fi if :; then echo A; fi | | (i.e., the combination "fi if") is a syntax error. That one is quite a different issue,