Reputation: 585
Given the following example:
$ echo foo | tee >(grep -o oo); echo bar
foo
bar
oo
As you can see, echo bar
is called before grep -o oo
has terminated.
(How) is it possible to achieve the following output instead?
foo
oo
bar
Thanks in advance!
Upvotes: 0
Views: 249
Reputation: 781058
The problem is that the process substitution runs that command in the background.
Put the second echo inside the process substitution.
echo foo | tee >(grep -o oo; echo bar)
Upvotes: 1