Here's why:
The command sed -e "s/a/b/" /tmp/file is used to replace all occurrences of the character a with the character b in the file /tmp/file.
The > symbol is used for redirection to write the output to a file, in this case, to overwrite the original file /tmp/file.
When the shell processes the command, it first opens the file /tmp/file for writing, and then executes the sed command.
Since the output file and the input file are the same (/tmp/file), the shell will overwrite the contents of the file before the sed command can read it.
As a result, the sed command will not find any occurrences of the character a in the input file, and will output nothing to the output file.
Therefore, the file /tmp/file will end up being empty after the command completes.
upvoted 1 times
...
This section is not available anymore. Please use the main Exam Page.LX0-103 Exam Questions
Log in to ExamTopics
Sign in:
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.
linux_admin
2 years, 2 months ago