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. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash