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 -- Geoff Clare <g.cl...@opengroup.org> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England