bug-bash
[Top][All Lists]
Advanced

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

Re: Syntax Question...


From: Greg Wooledge
Subject: Re: Syntax Question...
Date: Thu, 18 Aug 2011 12:14:03 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Aug 18, 2011 at 10:55:11AM -0400, Chet Ramey wrote:
> The quoted paragraph applies to all redirection operators (and parameter
> and variable expansion are still identical).  The description of <<<
> notes that it does not perform pathname expansion at all.

      The word following the redirection operator in the following
      descriptions, unless otherwise noted, is subjected to brace expansion,
      tilde expansion, parameter expansion, command substitution, arithmetic
      expansion, quote removal, pathname expansion, and word splitting.  If
      it expands to more than one word, bash reports an error.

      ...

    Here Strings
      A variant of here documents, the format is:

           <<<word

      The word is expanded and supplied to the command on its standard
      input.

I guess the "variant of here documents" part is meant to imply that all
of the exceptions from that section apply here as well.  It's a bit
unclear, though.  I'd suggest: "The word is expanded in the same way as
a here-document and supplied to the command on its standard input, with a
<newline> added."

The Here Document part says:

           <<[-]word
                   here-document
           delimiter

      No parameter expansion, command substitution, arithmetic expansion, or
      pathname expansion is performed on word.

That's clearly *not* how the word in <<< works, so it must work like the
here-document part (hence my wording choice above):

      If word is unquoted,
      all lines of the here-document are subjected to parameter expansion,
      command substitution, and arithmetic expansion.

Maybe it would be even better to repeat this directly in the <<< section,
where it applies to the word.  Either way would be an improvement.



reply via email to

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