rpm -qa > file | wc -l
returns 0. What am I doing wrong? I think it is clear what my goal is, but it isn't working. Is this a job for xargs
or tee
?
Shell – Redirect and pipe output
io-redirectionpipeshell
io-redirectionpipeshell
rpm -qa > file | wc -l
returns 0. What am I doing wrong? I think it is clear what my goal is, but it isn't working. Is this a job for xargs
or tee
?
Best Answer
Yes, this is job for tee:
In this construction
a | b
a's stdout goes to stdin of b. In case ofa > file | b
all output form a goes to file and nothing goes to b stdin.tee
command make a copy of all it receives on stdin to both file and stdout.