Question 170
An entry-level Linux support technician investigates: A support worker needs usernames from a colon-separated local sample file but passes the entire record to a script because they do not know how to extract fields. Which monitoring practice would best limit a repeat of this weakness?
Explanation
Correct Answer
This safeguard addresses cut extracts delimiter separated fields: Check delimiter conventions and sample lines before trusting fixed field positions in text processing scripts. The prevented failure mechanism is: The cut utility can select delimited fields from each line when supplied with an appropriate field number and separator. A control for an unrelated service cannot establish the required protection.
Incorrect Answers
Direct execution requires suitable executable permission on a regular file, while explicitly invoking Bash only needs permission to read its contents. “Use the minimum necessary execute permissions and verify ownership before marking scripts executable for multiple users” would remedy that alternative situation, but it would not correct the present issue: the cut utility can select delimited fields from each line when supplied with an appropriate field number and separator.
“Review redirection operators before running commands against existing reports or log files containing irreplaceable data” is the supported response when the > redirection truncates or creates an output file, while >> appends to the existing file in a normal shell. Here the decisive response is “Check delimiter conventions and sample lines before trusting fixed field positions in text processing scripts”, so that different intervention does not meet the stated requirement.
A shell pipeline connects one command's standard output to the next command's standard input. “Verify the intended stream is piped and be aware that stderr diagnostics are separate from ordinary standard output” applies to that other condition. The reported evidence is a support worker needs usernames from a colon-separated local sample file but passes the entire record to a script because they do not know how to extract fields; this alternative would address the wrong dependency.