bug-bash
[Top][All Lists]
Advanced

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

Re: nofork command substitution


From: Chet Ramey
Subject: Re: nofork command substitution
Date: Thu, 25 May 2023 10:17:01 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 5/25/23 8:13 AM, Robert Elz wrote:

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).

There's not any real difference. A group command is

'{' compound_list '}',

a nofork command substitution is

'${' compound_list '}',

and a command substitution is

'$(' compound_list ')'.

(Similar to how a subshell command is

'(' compound_list ')' ).

This is consistent with the POSIX grammar. The difference, as you say, is
that a command substitution is allowed as part of a word, so the closing
brace isn't a reserved word according to the strict definition.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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