When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?
Click on the arrows to vote for the correct answer
A. B. C. D. E.B
The command echo "foo bar" | tee bar | cat
can be broken down into three parts, each separated by the pipe |
character:
echo "foo bar"
: This command simply prints the string "foo bar" to standard output.
tee bar
: This command takes the standard input it receives from the previous command (echo "foo bar"
) and writes it both to standard output (which will be piped to the next command) and to a file called "bar".
cat
: This command simply reads from its standard input (which is coming from the output of the previous command, tee bar
) and writes it to standard output. Since there is no input coming after cat
, it will simply wait for input from tee bar
.
So the output of the command line will be "foo bar", which will be printed to standard output by cat
. Therefore, the correct answer is B. "foo bar".