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
|