Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation Exam LFCS Topic 2 Question 53 Discussion

Actual exam question for Linux Foundation's LFCS exam
Question #: 53
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: D

Contribute your Thoughts:

Alesia
4 days ago
Hmm, that makes sense too. Maybe we should review how sed works before the exam.
upvoted 0 times
...
Amber
4 days ago
Hmm, let's see... the file order is definitely not the issue here. And the sed command seems to be working fine, so it's not that either. Aha, I bet it's that sneaky overwrite that happens before the redirection kicks in! Gotta love those shell quirks.
upvoted 0 times
...
Julieta
6 days ago
I disagree, I believe the answer is B. The sed command did not match anything in the file.
upvoted 0 times
...
Lewis
7 days ago
Whoa, talk about a classic shell command conundrum! I bet the folks who write these certification exams just love tripping us up with little gotchas like this.
upvoted 0 times
...
Alesia
16 days ago
I think the answer is C. The shell overwrites the target file before the command starts.
upvoted 0 times
...

Save Cancel