Thanks for these insights.

Yes, I think that behavior makes sense.
I find the solution to run in a subshell really clean and elegant.

Regards,
Samuel

On 28.05.21 23:26, Bart Schaefer wrote:
On Fri, May 28, 2021 at 1:02 PM Stephane Chazelas <stephane@chazelas.org> wrote:
In both cases, tr/yes are being killed (with a SIGPIPE) because
they're trying to write to a pipe that has no reader. [...]

Which is printed (or rather here the "broken pipe" message
corresponding to that death-by-SIGPIPE) because of
PRINT_EXIT_VALUE.
Which is exactly what's supposed to happen when you have that set.

You can run the pipeline in a subshell to suppress this behavior:

( < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c 32; echo )

PRINT_EXIT_VALUE is disabled in subshells because subshells do not
normally maintain a jobs table like an interactive shell does.
--
Samuel Bancal
IT Eng
ENAC-IT
GR A0 464
EPFL

ENAC-IT is opening a new branch IT4Research to better support our labs in leveraging data in their research! Contact us with any questions related to data management, data valorization, data science and computational tools.