Simple answer:
how to fix:
ls /usr/bin -lha | tee --output-error=exit-nopipe >(wc -l) >(head) > /dev/null
Details:
The command headprints only the input header, so it can complete its task until it receives enough input, and then exits without waiting for all the data to be entered.
, head "head".
ls /usr/bin -lha | tee >(wc -l) >(read l; echo $l) > /dev/null
"head" , , pipe , tee .
, , "head". wc - .
, , , tee , tee , .
, , .
MODE determines behavior with write errors on the outputs:
'warn' diagnose errors writing to any output
'warn-nopipe'
diagnose errors writing to any output not a pipe
'exit' exit on error writing to any output
'exit-nopipe'
exit on error writing to any output not a pipe
The default MODE for the -p option is 'warn-nopipe'. The default operation
when --output-error is not specified, is to exit immediately on error writing to
a pipe, and diagnose errors writing to non pipe outputs.
, <(wc -l) , , 16384 20480, 4096.
4096 - PIPE_BUF UNIX. , PIPE_BUF, , 4096.