help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Not to set PIPESTATUS unless necessary


From: Peng Yu
Subject: Not to set PIPESTATUS unless necessary
Date: Wed, 8 May 2024 20:57:06 -0500

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
really necessary. Otherwise, users will have to preserve PIPESTATUS
after running true | true. This will result in more code to write.

Is there already a switch to turn on the behavior that I suggested? If
not, can this feature be added?

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]