exam questions

Exam LX0-103 All Questions

View all questions & answers for the LX0-103 exam

Exam LX0-103 topic 3 question 50 discussion

Actual exam question from CompTIA's LX0-103
Question #: 50
Topic #: 3
[All LX0-103 Questions]

When given the following command line.
echo "foo bar" | tee bar | cat
Which of the following output is created?

  • A. cat
  • B. foo bar
  • C. tee bar
  • D. bar
  • E. foo
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
linux_admin
2 years, 2 months ago
Here's why: The echo command is used to output the string "foo bar" to standard output. The | symbol is used for pipe redirection to send the output of the echo command to the tee command as input. The tee command is used to read its standard input and write it to both standard output and a file named bar. The | symbol is used again for pipe redirection to send the output of the tee command (which is the same as the input it received) to the cat command as input. The cat command is used to read its standard input and output it to standard output. So, when the command line is executed, the output "foo bar" is first written to standard output by the echo command. This output is then piped to the tee command, which writes it to standard output (where it is displayed on the terminal) and to the file bar. Finally, the output is piped to the cat command, which reads it from standard input and writes it to standard output (again displaying "foo bar" on the terminal). Therefore, the output of the command line is just the string "foo bar".
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago