U.S. Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation LFCS Exam - Topic 2 Question 115 Discussion

When running the commandsed -e "s/a/b/" /tmp/file >/tmp/fileWhile /tmp/file contains data, why is /tmp/file empty afterwards?
C) When the shell establishes the redirection it overwrites the target file before the redirected command starts and opens it for reading.
A) The file order is incorrect. The destination file must be mentioned before the command to ensure redirection.
B) The command sed did not match anything in that file therefore the output is empty.
D) Redirection for shell commands do not work using the > character. It only works using the | character instead.

Linux Foundation LFCS Exam - Topic 2 Question 115 Discussion

Actual exam question for Linux Foundation's LFCS exam
Question #: 115
Topic #: 2
[All LFCS Questions]

When running the command

sed -e "s/a/b/" /tmp/file >/tmp/file

While /tmp/file contains data, why is /tmp/file empty afterwards?

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel