Question 450
In a hands-on RHCSA practice VM, the assigned outcome was: A script invokes two commands on one line with a semicolon and prints success even if the first fails. What specific verification would demonstrate the target state?
Explanation
Correct Answer
In a fixture where the first command exits 1, the second command does not run. This check confirms the expected effect of: Use `first_command && second_command` when the second action must depend on the first succeeding. It distinguishes the intended result from the original failure mechanism: A semicolon runs subsequent commands irrespective of previous exit status; `&&` is conditional.
Incorrect Answers
Known values 9 and 10 route to different expected branches. That verifies a separate lab task: A script's `if` statement tests a numeric threshold using string comparison and misorders the values 9 and 10. It does not validate the implementation required here: Use `first_command && second_command` when the second action must depend on the first succeeding.
The resulting filename contains the current date digits and `tar -tzf` lists expected members. That verifies a separate lab task: A script generates a timestamped training archive but literal quotes around the `date` substitution prevent expansion. It does not validate the implementation required here: Use `first_command && second_command` when the second action must depend on the first succeeding.
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 `first_command && second_command` when the second action must depend on the first succeeding.