Question 250
The lab examiner asks for evidence after this assignment: A script's `if` statement tests a numeric threshold using string comparison and misorders the values 9 and 10. What is the decisive verification step?
Explanation
Correct Answer
Known values 9 and 10 route to different expected branches. This check confirms the expected effect of: Use `if [ "$count" -ge 10 ]; then ...; fi` after validating `count` is an integer. It distinguishes the intended result from the original failure mechanism: Shell test numeric operators compare integers, while lexical string operations do not model number magnitude.
Incorrect Answers
The output contains one result per unit and no unrequested service is started. That verifies a separate lab task: A service check is intended to poll five named systemd units, but the script uses only the first literal unit. It does not validate the implementation required here: Use `if [ "$count" -ge 10 ]; then ...; fi` after validating `count` is an integer.
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 `if [ "$count" -ge 10 ]; then ...; fi` after validating `count` is an integer.
The printed host label matches `hostname -s` without treating it as an executable. That verifies a separate lab task: A shell script writes raw command output but needs its first line to include the current hostname from the target host. It does not validate the implementation required here: Use `if [ "$count" -ge 10 ]; then ...; fi` after validating `count` is an integer.