bug-bash
[Top][All Lists]
Advanced

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

Re: nofork command substitution


From: Robert Elz
Subject: Re: nofork command substitution
Date: Thu, 25 May 2023 19:13:04 +0700

    Date:        Thu, 25 May 2023 19:29:40 +0900
    From:        Koichi Murase <myoga.murase@gmail.com>
    Message-ID:  
<CAFLRLk_8sm3ssk7fOgimmkAiThbdpG+uNiJiPtsG=mQ1tc3ifw@mail.gmail.com>

  | Does that mean ${(command)} would be explicitly unsupported even
  | though {(command)} is allowed for the brace grouping?

The two are mostly unrelated.

  | Would other cases without semicolons, such as ${ if ...; then ...; fi },
  | also be going to be removed?

Chet's message had nothing to do with the trailing ';' - I suspect he
includes it all the time just to reinforce that the '}' that ends the
cmdsub is required to appear (inside the cmdsub) in a command word position.
Any other syntax that allows that to happen should be OK.

What Chet is planning on removing is allowing the 'C' in the opening ${C
that indicates that this is a command substitution, and not some other kind
of expansion, will no longer have the case where C=='('.

The first char after the '{' in a "${' expansion has always indicated
what kind of thing is happening, if it is an alpha (including '_') it
is a variable expansion, if it is a digit (except 0) it is a positional
parameter expansion, if it is one of the special parameters (including '0')
it is a special parameter expansion, but that still leaves quite a few
more characters with (currently) no defined meaning.   bash has already
appropriated several of them I think, this proposal is just giving meanings
to two more, whitespace (' ' '\t' and '\n') and '|' which previously
would have been syntax errors, as they had no defined meaning.  The original
proposal included '(', but that wasn't really needed, and introduced
complexity (such as whether or not the matching ')' was required to be
last before the final '}' or not.   It was always possible to do
        ${ (commands) whatever else ; }
to run some commands in a subshell, then others not, and the "whatever
else" can be empty (in which case the ';' isn't required).

Note that ${C } is not a group - it is syntax that delimits a command 
substituition in a word, and what's in a command substitution is a list
(which can contain groups, or be one, but isn't required to be).

kre





reply via email to

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