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

2021-02-22 Thread Oğuz
Okay, thank you 22 Şubat 2021 Pazartesi tarihinde Chet Ramey yazdı: > On 2/22/21 12:59 AM, Oğuz wrote: > >> >> >> 21 Şubat 2021 Pazar tarihinde Chet Ramey > chet.ra...@case.edu>> yazdı: >> >> On 2/21/21 3:05 PM, Oğuz wrote: >> >> With the latest push to devel bash now accepts `if !

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

2021-02-22 Thread Chet Ramey
On 2/22/21 12:59 AM, Oğuz wrote: 21 Şubat 2021 Pazar tarihinde Chet Ramey > yazdı: On 2/21/21 3:05 PM, Oğuz wrote: With the latest push to devel bash now accepts `if ! [[ ... ]] then :; fi' too, but not `:() ! [[ ... ]]'. Is `! [[ ... ]]' (or `

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

2021-02-21 Thread Oğuz
21 Şubat 2021 Pazar tarihinde Chet Ramey yazdı: > On 2/21/21 3:05 PM, Oğuz wrote: > >> With the latest push to devel bash now accepts `if ! [[ ... ]] then :; >> fi' too, but not `:() ! [[ ... ]]'. Is `! [[ ... ]]' (or `time [[ ... ]]') >> a valid compound command or not? >> > > Technically not; t

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

2021-02-21 Thread Chet Ramey
On 2/21/21 3:05 PM, Oğuz wrote: With the latest push to devel bash now accepts `if ! [[ ... ]] then :; fi' too, but not `:() ! [[ ... ]]'. Is `! [[ ... ]]' (or `time [[ ... ]]') a valid compound command or not? Technically not; they're pipelines. -- ``The lyf so short, the craft so long to le

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

2021-02-21 Thread Oğuz
With the latest push to devel bash now accepts `if ! [[ ... ]] then :; fi' too, but not `:() ! [[ ... ]]'. Is `! [[ ... ]]' (or `time [[ ... ]]') a valid compound command or not? -- Oğuz

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

2021-02-18 Thread Chet Ramey
On 2/17/21 8:07 PM, Koichi Murase wrote: Now, they are fixed by Chet in the latest devel branch. Chet, I'm sorry that it seems I have pushed you, and thank you very much for your hard work. If I get interested in something, and I have the time, I'll work on it even if there's no practical bene

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

2021-02-18 Thread Chet Ramey
On 2/17/21 6:40 PM, Robert Elz wrote: 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) Why would I write an entirely new parser when I already have one that works just fine

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,

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

2021-02-16 Thread Lawrence Velázquez
> On Feb 16, 2021, at 10:42 PM, Dale R. Worley wrote: > >> Oğuz 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. > But there's no c

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

2021-02-16 Thread Dale R. Worley
Oğuz writes: >> Before we worry about what to change, I want to note that the original >> example is syntactically incorrect. The example is >> >> $ bash -c ': $(case x in x) esac)' >> >> But the manual page makes it clear that each case must be ended with >> ";;". > > `;;' is optional for the

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

2021-02-16 Thread Oğuz
On Tue, Feb 16, 2021 at 5:34 PM Koichi Murase wrote: > Maybe Bash could insist that [[ ... ]] and ((...)) are not part of the > standard so that it can behave inconsistently. But it seems to me > that there is really no reason to behave inconsistently here. > They resemble `[ ... ]' (I know it'

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

2021-02-16 Thread Koichi Murase
> XCU 2.10.2/(1) Shell Grammar Rules [Command Name] > > When the TOKEN is exactly a reserved word, the token identifier for > > that reserved word shall result. Otherwise, the token WORD shall be > > returned. Also, if the parser is in any state where only a reserved > > word could be the next corr

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

2021-02-16 Thread Chet Ramey
On 2/16/21 12:29 AM, Oğuz wrote: 16 Şubat 2021 Salı tarihinde Koichi Murase > yazdı: bash -c ': $(case x in esac)' bash -c ': $(case x in (x) if :; then echo a; fi esac)' bash -c ': $(case x in (x) a() { echo a; } esac)' bash -c ': $(case x in (x) f

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

2021-02-16 Thread Koichi Murase
2021年2月16日(火) 21:41 Oğuz : >> > XRAT Shell Grammar ( >> > https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_10 >> > ) explains that giving almost the same examples as we posted in >> > this thread. >> >> Thank you, interesting! So, if I understand correctly, the fol

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

2021-02-16 Thread Oğuz
16 Şubat 2021 Salı tarihinde Koichi Murase yazdı: > 2021年2月16日(火) 19:24 Oğuz : > > XRAT Shell Grammar ( https://pubs.opengroup.org/ > onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_10 ) explains > that giving almost the same examples as we posted in this thread. > > Thank you, interesti

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

2021-02-16 Thread Koichi Murase
2021年2月16日(火) 19:24 Oğuz : > XRAT Shell Grammar ( > https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_10 > ) explains that giving almost the same examples as we posted in this thread. Thank you, interesting! So, if I understand correctly, the following construct

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

2021-02-16 Thread Koichi Murase
2021年2月16日(火) 19:29 Chris Elvidge : > > I think that section just describes the necessary condition that the > > word is recognized as the reserved keyword: "This recognition shall > > *only* occur...". It doesn't explain whether the reserved keyword can > > be really used to construct the AST foll

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

2021-02-16 Thread Chris Elvidge
On 16/02/2021 10:19 am, Koichi Murase wrote: 2021年2月16日(火) 16:28 Andreas Schwab : See 2.4 Reserved Words. This recognition shall only occur when none of the characters is quoted and when the word is used as: I think that section just describes the necessary condition that the word i

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

2021-02-16 Thread Oğuz
16 Şubat 2021 Salı tarihinde Koichi Murase yazdı: > OK, now I understood this behavior is > actually required by the POSIX standard. Can we find any textual > explanation on this rule? Or maybe this behavior is intuitive enough > for those who understand the shell grammar so that they don't see t

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

2021-02-16 Thread Koichi Murase
2021年2月16日(火) 16:28 Andreas Schwab : > See 2.4 Reserved Words. > > This recognition shall only occur when none of the characters is > quoted and when the word is used as: I think that section just describes the necessary condition that the word is recognized as the reserved keyword: "This

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

2021-02-16 Thread Andreas Schwab
On Feb 16 2021, Koichi Murase wrote: > Because the ending keywords---}, fi, done, and esac---are allowed to > be chained, which I think is undocumented though. See 2.4 Reserved Words. This recognition shall only occur when none of the characters is quoted and when the word is used as:

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

2021-02-15 Thread Koichi Murase
2021年2月16日(火) 13:56 Oğuz : > $ if (:) then (:) fi > $ > > I had no idea. Oh, I forgot about `(list)'. I should also add this to the list: $ bash -c ': $(case x in (x) (echo a) esac)' -- Koichi

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

2021-02-15 Thread Oğuz
On Tue, Feb 16, 2021 at 8:34 AM Koichi Murase wrote: > Because the ending keywords---}, fi, done, and esac---are allowed to > be chained, which I think is undocumented though. > > $ { { { { { echo "Something like this is allowed"; } } } } } > Huh. So a compound list consisting of a single compou

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

2021-02-15 Thread Koichi Murase
2021年2月16日(火) 13:29 Oğuz : > 16 Şubat 2021 Salı tarihinde Koichi Murase yazdı: >> bash -c ': $(case x in esac)' >> bash -c ': $(case x in (x) if :; then echo a; fi esac)' >> bash -c ': $(case x in (x) a() { echo a; } esac)' >> bash -c ': $(case x in (x) for ((i=0;i<10;i++)) { echo a; } esac)' >> b

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

2021-02-15 Thread Oğuz
16 Şubat 2021 Salı tarihinde Koichi Murase yazdı: > > bash -c ': $(case x in esac)' > bash -c ': $(case x in (x) if :; then echo a; fi esac)' > bash -c ': $(case x in (x) a() { echo a; } esac)' > bash -c ': $(case x in (x) for ((i=0;i<10;i++)) { echo a; } esac)' > bash -c ': $(case x in (x) while

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

2021-02-15 Thread Chet Ramey
On 2/15/21 5:39 PM, Koichi Murase wrote: 2021年2月16日(火) 5:12 Chet Ramey : It is unexpected, though the syntax is obscure. I'll fix it. If this is to be fixed, maybe also the following cases could be handled better (if the corresponding fixes are not too complicated). At some point, maybe. The

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

2021-02-15 Thread Koichi Murase
2021年2月16日(火) 5:12 Chet Ramey : > It is unexpected, though the syntax is obscure. I'll fix it. If this is to be fixed, maybe also the following cases could be handled better (if the corresponding fixes are not too complicated). bash -c ': $(case x in esac)' bash -c ': $(case x in (x) if :; then e

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

2021-02-15 Thread Chet Ramey
On 2/15/21 4:35 PM, Lawrence Velázquez wrote: On Feb 15, 2021, at 10:01 AM, Chet Ramey wrote: The bash command substitution parser handles the majority of these cases (heh) lol I chuckled, well done I'll be here all week. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer

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

2021-02-15 Thread Lawrence Velázquez
> On Feb 15, 2021, at 10:01 AM, Chet Ramey wrote: > > The bash command substitution parser handles the majority of these > cases (heh) lol I chuckled, well done vq

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

2021-02-15 Thread Chet Ramey
On 2/13/21 3:21 PM, Oğuz wrote: $ bash -c ': $(case x in x) esac)' bash: -c: line 1: unexpected EOF while looking for matching `)' bash: -c: line 2: syntax error: unexpected end of file `case x in x) esac' is a complete case command, a syntax error is unexpected here. It is unexpected

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

2021-02-15 Thread Chet Ramey
On 2/14/21 6:02 AM, Robert Elz wrote: | I guess you are using Bash for so many years, Yes, since Paul Fox created and maintained it (version 1). It allowed me to escape from csh. (It's Brian Fox.) How long ago, and do you have any old source versions lying around? I'm always trying to g

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

2021-02-15 Thread Chet Ramey
On 2/13/21 5:21 PM, Robert Elz wrote: | $ bash -c ': $(case x in x) esac)' This is a well known bash deficiency. When parsing command substitutions it (approximately) simply counts (unquoted) parentheses to find the end. Anything with a valid closing ')' but with no opening '(' confuses

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

2021-02-14 Thread Andreas Schwab
On Feb 14 2021, Eli Schwartz wrote: > On 2/14/21 3:35 PM, Andreas Schwab wrote: >> On Feb 14 2021, Eli Schwartz wrote: >> >>> Just a running trend that esac does not get recognized without a >>> separator. >> >> $ bash -c 'case x in x) esac' > > The thread title does mention $(...) as the releva

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

2021-02-14 Thread Eli Schwartz
On 2/14/21 3:35 PM, Andreas Schwab wrote: > On Feb 14 2021, Eli Schwartz wrote: > >> Just a running trend that esac does not get recognized without a >> separator. > > $ bash -c 'case x in x) esac' The thread title does mention $(...) as the relevant context up for discussion. Apologies if my te

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

2021-02-14 Thread Andreas Schwab
On Feb 14 2021, Eli Schwartz wrote: > Just a running trend that esac does not get recognized without a > separator. $ bash -c 'case x in x) esac' Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something co

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

2021-02-14 Thread Lawrence Velázquez
> On Feb 14, 2021, at 3:00 PM, Oğuz wrote: > > 14 Şubat 2021 Pazar tarihinde Dale R. Worley yazdı: > >> Before we worry about what to change, I want to note that the original >> example is syntactically incorrect. The example is >> >> $ bash -c ': $(case x in x) esac)' >> >> But the manual

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

2021-02-14 Thread Eli Schwartz
On 2/14/21 2:43 PM, Dale R. Worley wrote: > Before we worry about what to change, I want to note that the original > example is syntactically incorrect. The example is > > $ bash -c ': $(case x in x) esac)' > > But the manual page makes it clear that each case must be ended with > ";;". > >

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

2021-02-14 Thread Oğuz
14 Şubat 2021 Pazar tarihinde Dale R. Worley yazdı: > Before we worry about what to change, I want to note that the original > example is syntactically incorrect. The example is > > $ bash -c ': $(case x in x) esac)' > > But the manual page makes it clear that each case must be ended with > ";

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

2021-02-14 Thread Dale R. Worley
Before we worry about what to change, I want to note that the original example is syntactically incorrect. The example is $ bash -c ': $(case x in x) esac)' But the manual page makes it clear that each case must be ended with ";;". case word in [ [(] pattern [ | pattern ] ... ) list ;;

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

2021-02-14 Thread Oğuz
14 Şubat 2021 Pazar tarihinde Robert Elz yazdı: > > That's a step up on outright rejecting them, which they do from time > to time. I don't much care, anyone who really cares about receiving > e-mail shouldn't be using gmail. > What else am I gonna use? It's free -- Oğuz

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

2021-02-14 Thread Robert Elz
Date:Sun, 14 Feb 2021 13:14:29 + From:Stephane Chazelas Message-ID: <20210214131429.yxr5egs7zs6fe...@chazelas.org> | ITYM Brian Fox. Yes, probably ... my memory is pathetic, and that was all a long time ago. kre

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

2021-02-14 Thread Stephane Chazelas
2021-02-14 18:02:52 +0700, Robert Elz: [...] > | I guess you are using Bash for so many years, > > Yes, since Paul Fox created and maintained it (version 1). It allowed > me to escape from csh. ITYM Brian Fox. Maybe the confusion comes from zsh's Paul Falstad. -- Stephane

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

2021-02-14 Thread Robert Elz
Date:Sun, 14 Feb 2021 17:00:06 +0800 From:Koichi Murase Message-ID: | I guess you are using Bash for so many years, Yes, since Paul Fox created and maintained it (version 1). It allowed me to escape from csh. | but it was fixed in Bash 4.0 (2009). That is

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

2021-02-14 Thread Koichi Murase
2021年2月14日(日) 17:16 Oğuz : >> This is interesting. I think this is just an oversight. A quick fix >> like the attached patch should be fine. [ Note: The patch seems to >> work fine, but I haven't carefully read the code, so I'm not sure if >> this fix is really correct. ] > > It seems to be on the

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

2021-02-14 Thread Oğuz
14 Şubat 2021 Pazar tarihinde Koichi Murase yazdı: > 2021年2月14日(日) 15:41 Andreas Kusalananda Kähäri : > > And using (x) doesn't help: > > > > % bash -c ': $(case x in (x) esac)' > > bash: -c: line 1: unexpected EOF while looking for matching `)' > > bash: -c: line 2: syntax error: unexpected end

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

2021-02-14 Thread Koichi Murase
2021年2月14日(日) 15:41 Andreas Kusalananda Kähäri : > And using (x) doesn't help: > > % bash -c ': $(case x in (x) esac)' > bash: -c: line 1: unexpected EOF while looking for matching `)' > bash: -c: line 2: syntax error: unexpected end of file This is interesting. I think this is just an oversight.

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

2021-02-13 Thread Andreas Kusalananda Kähäri
On Sun, Feb 14, 2021 at 12:02:02AM +0100, Andreas Schwab wrote: > On Feb 14 2021, Robert Elz wrote: > > > Date:Sat, 13 Feb 2021 23:21:36 +0300 > > From:=?UTF-8?B?T8SfdXo=?= > > Message-ID: > > > > > > | $ bash -c ': $(case x in x) esac)' > > > > This is a well k

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

2021-02-13 Thread Lawrence Velázquez
> On Feb 13, 2021, at 5:21 PM, Robert Elz wrote: > > This problem has been known for a LONG time, without it being fixed. I played around with shbot on Freenode for a bit. "LONG time" is right: bash50 -c ': $(case x in x) esac)' bash50: -c: line 0: unexpected EOF while looking for matching `

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

2021-02-13 Thread Oğuz
14 Şubat 2021 Pazar tarihinde Robert Elz yazdı: > Date:Sat, 13 Feb 2021 23:21:36 +0300 > From:=?UTF-8?B?T8SfdXo=?= > Message-ID: j...@mail.gmail.com> > > | $ bash -c ': $(case x in x) esac)' > > This is a well known bash deficiency. When parsing command substit

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

2021-02-13 Thread Andreas Schwab
On Feb 14 2021, Robert Elz wrote: > Date:Sat, 13 Feb 2021 23:21:36 +0300 > From:=?UTF-8?B?T8SfdXo=?= > Message-ID: > > > | $ bash -c ': $(case x in x) esac)' > > This is a well known bash deficiency. When parsing command substitutions > it (approximately) simpl

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

2021-02-13 Thread Robert Elz
Date:Sat, 13 Feb 2021 23:21:36 +0300 From:=?UTF-8?B?T8SfdXo=?= Message-ID: | $ bash -c ': $(case x in x) esac)' This is a well known bash deficiency. When parsing command substitutions it (approximately) simply counts (unquoted) parentheses to find the end. An

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

2021-02-13 Thread Andreas Kusalananda Kähäri
On Sat, Feb 13, 2021 at 03:41:30PM -0500, Lawrence Velázquez wrote: > > On Sat, Feb 13, 2021, 21:34 Alex fxmbsw7 Ratchev wrote: > > > > you didnt end the case, wrong syntax > > echo $( case x in y) printf 1 ;; x) printf 2 ;; esac ) > > $ case x in x) esac > $ echo $? > 0 > > > On Feb 13, 2021,

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

2021-02-13 Thread Lawrence Velázquez
> On Sat, Feb 13, 2021, 21:34 Alex fxmbsw7 Ratchev wrote: > > you didnt end the case, wrong syntax > echo $( case x in y) printf 1 ;; x) printf 2 ;; esac ) $ case x in x) esac $ echo $? 0 > On Feb 13, 2021, at 3:36 PM, Alex fxmbsw7 Ratchev wrote: > > you have to specify something for ) even w

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

2021-02-13 Thread Alex fxmbsw7 Ratchev
you have to specify something for ) even when its just a * wildcard On Sat, Feb 13, 2021, 21:34 Alex fxmbsw7 Ratchev wrote: > you didnt end the case, wrong syntax > echo $( case x in y) printf 1 ;; x) printf 2 ;; esac ) > > On Sat, Feb 13, 2021, 21:21 Oğuz wrote: > >> $ bash -c ': $(case x in

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

2021-02-13 Thread Alex fxmbsw7 Ratchev
you didnt end the case, wrong syntax echo $( case x in y) printf 1 ;; x) printf 2 ;; esac ) On Sat, Feb 13, 2021, 21:21 Oğuz wrote: > $ bash -c ': $(case x in x) esac)' > bash: -c: line 1: unexpected EOF while looking for matching `)' > bash: -c: line 2: syntax error: unexpected end of fil