cc: [email protected]
Subject: Re: Re: [ast-developers] Reverse redirection / assignment order
--------

> In retrospect, the Bash way makes sense. To force reverse evaluation for the
> redirect first in Bash only requires wrapping with a command group. If the
> redirect evaluates first by default, then reversing that to evaluate an
> assignment first is much harder, since assignments can't precede compound
> commands.
> 
>     # Hide foo's err in bash
>     { var=$(foo) cmd; } 2>/dev/null
> 
> versus (e.g. if cmd is a ksh-style function)
> 
>     # Don't hide foo's err in ksh
>     var=$(foo) command eval cmd 2\>/dev/null
>     { var=$(foo >&3) cmd 2>/dev/null; } 3>&1
> 
> The former is obviously better, at the cost of breaking anything that
> relies on the standard behavior. Apparently nobody's complained in the last 2
> decades.
> 
> 

I don't get your point.
>     { var=$(foo) cmd; } 2>/dev/null
will hide the error in ksh since redirections are done first for compound
commands.
        var=$(foo) cmd  2>/dev/null
will not hide assignment errors, but since the assignment is on the {...}
it is done first.

David Korn
[email protected]
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to