Jirka Hladky wrote: > I have recently run into an issue that tee will finish as soon as first > pipe it's writing to is closed. Please consider this example: > > $cat /dev/zero | tee >(head -c1 | wc -c ) >(head -c100M | wc -c ) >/dev/null > 1 > 65536 > > Second wc command will receive only 64kB instead of expected 100MB.
Expectations depend upon the beholder of the expectation. :-) > IMHO, tee should have a command line option to proceed as long some file is > opened. > > cat /dev/zero | mytee --skip_stdout_output --continue_on_sigpipe >(head -c1 > | wc -c ) >(head -c100M | wc -c ) If you ignore SIGPIPE in tee in the above then what will terminate the tee process? Since the input is not ever terminated. Also, a Useless-Use-Of-Cat in the above too. > It should be accompanied by another switch which will suppress > writing to STDOUT. Isn't >/dev/null already a sufficient switch to supress stdout? Bob
