Question 250
A production Linux service requires a fix for this issue: A script appends one line each run and duplicates the same configuration repeatedly. Which change meets the requirement without weakening unrelated controls?
Explanation
Correct Answer
The fix addresses the cause: unconditional append operations accumulate duplicate records. A suitable acceptance test is that a second run leaves the configuration unchanged.
Incorrect Answers
That remedy is appropriate when a script executes a second command even after the first command fails. It targets shell command exit statuses require explicit checks to implement fail-fast behavior; here unconditional append operations accumulate duplicate records, so it does not directly repair the observed fault.
It would correct a separate failure, an application script needs a local function variable that does not replace an outer variable. In this environment, unconditional append operations accumulate duplicate records; the indicated alternative does not meet the acceptance test.
That remedy is appropriate when a script requires the output of hostname as part of a destination path. It targets command substitution captures stdout of a command into a variable; here unconditional append operations accumulate duplicate records, so it does not directly repair the observed fault.





CompTIA Linux+ (XK0-006) Practice Tests