This question already has an answer here:
What I want is printing the output the first line ( table head ) of
ps aux and the grep result.
After search, I come up with following.
ps aux | tee >(head -1 > /dev/tty) | grep mongo
But I find the stdin of
grep mongo is cut off.
Also, if I omit
> /dev/tty, what will the stdout of
head -1 direct to? Why isn't it the console?
(Yes, I know I can achive my purpose by command
awk. I am just curious about why my command doesn't work?)