bug-bash
[Top][All Lists]
Advanced

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

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


From: felix
Subject: Re: Why tail coreutil cannot work as its input is from tee
Date: Mon, 6 Sep 2021 10:43:55 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

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 06, 2021 at 07:38:03AM +0000, 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
> 

-- 
 Félix Hauri  -  <felix@f-hauri.ch>  -  http://www.f-hauri.ch



reply via email to

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