On Thu, 9 May 2024, at 2:57 AM, Peng Yu wrote:
> Hi,
>
> true | true
> false
> echo ${PIPESTATUS[@]}
>
> In the above commands, echo will print 1. But such information is also
> available in $?. Therefore, I think it is unnecessary to set
> PIPESTATUS after false. It is better to preserve its value until it is
Bear in mind that "false" is also a foreground pipeline there.
> really necessary. Otherwise, users will have to preserve PIPESTATUS
> after running true | true. This will result in more code to write.
Can you show a realistic program in which it necessitates significantly more
code?
>
> Is there already a switch to turn on the behavior that I suggested? If
> not, can this feature be added?
There exists no such switch.
--
Kerin Millar