On 01/09/2021 17:22, Geoff Clare via austin-group-l at The Open Group wrote:
Harald van Dijk wrote, on 01 Sep 2021:The second problem is the redirection. Based on the above, command substitutions in a redirection are supposed to affect the exit status just as any other command substitution, but the standard says: 3. Redirections shall be performed as described in Redirection. 4. Each variable assignment shall be expanded for tilde expansion, parameter expansion, command substitution, arithmetic expansion, and quote removal prior to assigning the value. This means the command substitution in your redirection is supposed to be performed prior to that in the variable assignment.After the list, the standard says: In the preceding list, the order of steps 3 and 4 may be reversed if no command name results from step 2 or if the command name matches the name of a special built-in utility
Ah, thank you. That means the outputs "1 0 0" and "2 0 0" are both equally correct. I assume the outputs "1 2 1" and "2 0 1" do indicate shell bugs.
Cheers, Harald van Dijk
