Email List: Xaustin-group-lX
[All Lists]

Here-documents in $(...) (was: compound commands withsubshells/braces)

To: austin-group-l@xxxxxxxxxxxxx
Subject: Here-documents in $(...) (was: compound commands withsubshells/braces)
From: Geoff Clare <gwc@xxxxxxxxxxxxx>
Date: Wed, 27 May 2009 15:37:10 +0100
References: <4A15E71C.3070202@sonic.net> <200905261440.n4QEep5H018582@penguin.research.att.com> <20090527095232.GA18259@squonk.masqnet> <4A1D25C9.5000907@byu.net>
Eric Blake <ebb9@byu.net> wrote, on 27 May 2009:
>
> It would be worth having the standard specify whether both of
> these examples are well-behaved (and print hi) or syntax errors:
> 
> echo $(
> cat <<\)
> hi
> )
> )
> 
> echo $(
> cat <<EOF
> hi
> EOF)

The standard is already clear that both of these must print hi.
It is clear from this paragraph (specifically the phrase "any
valid shell script") in the middle of 2.6.3 Command Substitution:

    "With the $(command) form, all characters following the open
    parenthesis to the matching closing parenthesis constitute the
    command. Any valid shell script can be used for command, except a
    script consisting solely of redirections which produces
    unspecified results."

-- 
Geoff Clare <g.clare@opengroup.org>
The Open Group, Thames Tower, Station Road, Reading, RG1 1LX, England

<Prev in Thread] Current Thread [Next in Thread>