[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 you want the brace expansion deferred until the subshell executes, you have to explicitly say so: cat <(eval cat /etc/\{passwd,motd}) The backslash suppresses brace expansion in the parent shell; the eval forces it in the subshell. (The backslash is passed through to the subshell.) Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash