Question 360
After the variables are assigned, this RHEL 10 Bash snippet runs: #!/bin/bash x=92; threshold=21 if [ "$x" -gt "$threshold" ]; then echo branch-yes-24; else echo branch-no-24; fi Which output line follows?
Explanation
Correct Answer
Bash evaluates 92 -gt 21 as true using integer operands, so execution enters the then branch and prints branch-yes-24. The branch selection follows the numeric test, not lexical string comparison.
Incorrect Answers
The other branch would print branch-no-24, but 92 -gt 21 is true; the script therefore chooses then. The Bash [] test returns a status before either echo runs.
There is no comparison syntax error: [ "$x" -gt "$threshold" ] has two initialized integer operands (92 and 21), a valid test operator and the closing bracket required by Bash.
No-output is impossible here: the test of 92 and 21 via -gt selects exactly one echo statement, and both branches write a line to standard output under normal Bash execution.






Red Hat Certified System Administrator (RHCSA) (EX200) Practice Tests