IBM
C9010-022 · Question #88
Why does the following ksh code segment fail to run? if [ $src -eq 0 ]; then echo "command completed successfully." exit $src elseIf [ $src -eq 101 ]; then echo "command failed with debug return…
The correct answer is C. The 'elseif' keyword is not valid within ksh scripts. See the full explanation below for the reasoning.
Question
Why does the following ksh code segment fail to run?
if [ $src -eq 0 ]; then
echo "command completed successfully."
exit $src
elseIf [ $src -eq 101 ]; then
echo "command failed with debug return code 101."
exit $src
fi
Options
- AAn alphanumeric operator is being used to compare the integer variable.
- BThe 'if' statement must be terminated with an 'end' keyword.
- CThe 'elseif' keyword is not valid within ksh scripts.
- DThe segment is missing an 'else' default statement.
How the community answered
(24 responses)- A13% (3)
- B4% (1)
- C79% (19)
- D4% (1)
Community Discussion
No community discussion yet for this question.