bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nofork command substitution


From: Koichi Murase
Subject: Re: nofork command substitution
Date: Thu, 25 May 2023 19:29:40 +0900

2023年5月24日(水) 22:27 Chet Ramey <chet.ramey@case.edu>:
> > [...]
>
> Thanks for testing it.

Thank you for all the explanations and clarifications.

> Both are valid, but don't get too fond of ${(command)} -- I'm going to
> remove it in favor of people using ${ (command); } if they want a subshell.

Does that mean ${(command)} would be explicitly unsupported even
though {(command)} is allowed for the brace grouping? Would other
cases without semicolons, such as ${ if ...; then ...; fi }, also be
going to be removed?

> > Then, can I understand the grammar in the following way?  First, there
> > are two types of nofork command substitutions:
> >
> >    ${ compound_list }
> >    ${| compound_list }
> >
> > where `compound_list' is what is defined by EBNF in POSIX XCU 2.10.2.
>
> You could always look at the shell grammar:
>
> [...]
>
> funsub:         DOLBRACE compound_list '}'
>                          {
>                            $$ = $2;
>                          }
>          |       DOLBRACE newline_list '}'
>                          {
>                            $$ = (COMMAND *)NULL;
>                          }

OK, I haven't checked the grammar definition in the source code. I now
looked into parse.y, but it doesn't seem to be so clear to me what
would be the distinction among the variations of C = <space>, <tab>,
<newline>, `(', and `|' for `${C command; }' just by looking at the
definition. It seems to be processed on subst.c:6880 semantically.
Anyway, I'm satisfied now.

Thank you.

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]