Question 50
In a hands-on RHCSA practice VM, the assigned outcome was: A backup script runs even when its destination directory cannot be created, silently losing its output. What specific verification would demonstrate the target state?
Explanation
Correct Answer
A simulated directory creation failure stops the script before any misleading success message. This check confirms the expected effect of: Use `mkdir -p /tmp/lab-backups || exit 1` before the subsequent archive command. It distinguishes the intended result from the original failure mechanism: A nonzero command status must be checked when later actions depend on it.
Incorrect Answers
Arguments containing spaces are printed as single intended entries and the loop count matches input count. That verifies a separate lab task: A housekeeping script must print each user-provided directory rather than always print one hard-coded value. It does not validate the implementation required here: Use `mkdir -p /tmp/lab-backups || exit 1` before the subsequent archive command.
The known present and missing fixture processes produce different status messages. That verifies a separate lab task: A maintenance script must report whether a given process name exists without exiting with a misleading success status. It does not validate the implementation required here: Use `mkdir -p /tmp/lab-backups || exit 1` before the subsequent archive command.
In a fixture where the first command exits 1, the second command does not run. That verifies a separate lab task: A script invokes two commands on one line with a semicolon and prints success even if the first fails. It does not validate the implementation required here: Use `mkdir -p /tmp/lab-backups || exit 1` before the subsequent archive command.