Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread Greg Wooledge
On Mon, Sep 06, 2021 at 07:38:03AM +, Budi wrote: > How come tail coreutil cannot work as its input is from tee > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tail -1 > 1 > > But : > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1) |tail -1 > 9 > > Please help explain It would be better if yo

Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread Andreas Kusalananda Kähäri
On Mon, Sep 06, 2021 at 07:38:03AM +, Budi wrote: > How come tail coreutil cannot work as its input is from tee > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tail -1 > 1 > > But : > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1) |tail -1 > 9 > > Please help explain I don't see how this is

Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread felix
Because your last pipe will pipe BOTH output of `echo` AND `head` with delay due to fork, head output will comme after. try this: echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1 >&2) |tail -1 or echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1 >&2) >(tail -1 >&2) >/dev/null ... On Mon, Sep

Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread Mike Jonkmans
On Mon, Sep 06, 2021 at 07:38:03AM +, Budi wrote: > How come tail coreutil cannot work as its input is from tee > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tail -1 > 1 > > But : > > $ echo -e '9\n4\n3\n2\n8\n7\n3\n1' |tee >(head -1) |tail -1 > 9 > > Please help explain Not a bug. If you leave

Re: Why tail coreutil cannot work as its input is from tee

2021-09-06 Thread Alex fxmbsw7 Ratchev
if u d try echo .. | tee >( >/dev/null ) | tail -1 i havent tested, but im trying to say, the stdout by head seems to be taken i mean heads stdout prioritizes im not sure.. ppl ( that know .. ) .. write about it :) -- Forwarded message - From: Budi Date: Mon, Sep 6, 2021, 09:38 Su