LPI
101-500 · Question #42
101-500 Question #42: Real Exam Question with Answer & Explanation
Sign in or unlock 101-500 to reveal the answer and full explanation for question #42. The question stem and answer options stay visible for context.
Shells and Shell Scripting
Question
When running the command sed -e "s/a/b/" /tmp/file >/tmp/file While /tmp/file contains data, why is /tmp/file empty afterwards?
Options
- AThe file order is incorrect. The destination file must be mentioned before the command to ensure
- BThe command sed did not match anything in that file therefore the output is empty.
- CWhen the shell establishes the redirection it overwrites the target file before the redirected
- DRedirection for shell commands do not work using the > character. It only works using the |
Unlock 101-500 to see the answer
You've previewed enough free 101-500 questions. Unlock 101-500 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Shell I/O Redirection#File Truncation#sed#Input/Output