Question 310
A technician working on a classroom Linux system finds: A student tries to save stderr diagnostics from an invalid command but redirects only normal output and sees no saved error. Which safe test outcome confirms the correction?
Explanation
Correct Answer
A deliberately invalid command writes its diagnostic text to errors.txt and not to the standard-output file. This is specific evidence for the stated requirement. The explanation is: Standard output and standard error are separate numbered streams handled by the shell's redirection syntax. The required action is: Use an explicit standard-error redirect such as 2> errors.txt for the diagnostic stream.
Incorrect Answers
This test can succeed without resolving the cause described here. It addresses: Extended regular expressions enable alternation and grouping syntax not identical to basic grep patterns. The relevant causal dependency is: Standard output and standard error are separate numbered streams handled by the shell's redirection syntax. The required validation is “A deliberately invalid command writes its diagnostic text to errors.txt and not to the standard-output file”.
The alternative measures an outcome associated with: A character class matches one character from its stated range rather than the literal bracket text. It does not verify the stated failure. Here standard output and standard error are separate numbered streams handled by the shell's redirection syntax. Confirm “A deliberately invalid command writes its diagnostic text to errors.txt and not to the standard-output file”.
That observation would verify a different mechanism: Sort orders records but does not ordinarily remove duplicates; uniq removes repeated neighboring lines. It would not establish whether the present failure was corrected, because standard output and standard error are separate numbered streams handled by the shell's redirection syntax. Test “A deliberately invalid command writes its diagnostic text to errors.txt and not to the standard-output file” instead.