Robert Elz <k...@munnari.oz.au> wrote: > When the { } are there there's no question the redirect on the compound > command itself happens first, and then the contents of that are executed, > so then it all works. > > Personally I think the "may be reversed" (not even "shall be") is a mistake, > and just pandering to bugs in old shells, but this is the world we live in > and applications simply cannot rely, either way, on the evaluation order > when there is no command name (or on special built-ins.)
This is not a bug, but a design decision. In this area, there is however a bug in the historic Bourne Shell as e.g. seen on Solaris: Redirection with complex commands did not work and if ... then .... else ... > /dev/null did only redirect the else part of the command. A shell that does not fix this, will not capture stderr in $ls_err at all. The background is that IO redirection previously was bound to a TFORK node in the syntax tree created by the parser. Newer shells added a TSETIO node... Since nothing was wrong with the decision to do IO redirection in the forked child that soon will call the command, "may be reversed" cannot be seen as a mistake. Jörg -- EMail:jo...@schily.net (home) Jörg Schilling D-13353 Berlin joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'