On 18/04/07 at 11:11 +0200, Andreas Schwab wrote:
> Chet Ramey <[EMAIL PROTECTED]> writes:
> 
> > [EMAIL PROTECTED] wrote:
> >
> >> Bash Version: 3.1
> >> Patch Level: 17
> >> Release Status: release
> >> 
> >> Description:
> >> Hi,
> >> 
> >> The expansion of echo <(cat /etc/{passwd,motd}) is rather surprising:
> >> $  echo <(cat p.main.{optional,extra})
> >> ++ cat p.main.optional
> >> cat: p.main.optional: No such file or directory
> >> ++ cat p.main.extra
> >> cat: p.main.extra: No such file or directory
> >> + echo /dev/fd/63 /dev/fd/62
> >> /dev/fd/63 /dev/fd/62
> >> 
> >> I would have expected to be expanded to <(cat /etc/passwd /etc/motd) first.
> >
> > That's not how it works.  Brace expansion is the first expansion performed.
> > The manual page says:
> >
> > "Brace expansion is performed before any other expansions, and any char-
> > acters special to other expansions are preserved in the result.  It  is
> > strictly  textual.  Bash does not apply any syntactic interpretation to
> > the context of the expansion or the text between the braces."
> 
> If it would be done strictly textual, the resulting expansion would
> actually be this:
> 
> $ echo <(cat p.main.optional) p.main.extra)
> 
> which would be a syntax error.

Well, no, because bash expands *parameters*, not words. So the prefix is
"<(cat /etc/", and the suffix is ")".
-- 
| Lucas Nussbaum
| [EMAIL PROTECTED]   http://www.lucas-nussbaum.net/ |
| jabber: [EMAIL PROTECTED]             GPG: 1024D/023B3F4F |


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to