题目
FA25_ISOM_661_4102 Shell - MC Quiz
多项选择题
Which of the following shell scripts (if any) correctly prints TRUE if x and y are both equal to 10? Select all that apply.
选项
A.if [ $x == 10 & $y == 10 ]; then
echo TRUE
fi
B.None of the other answers is correct
C.if [ $x -eq 10 -a $y -eq 10 ]; then
echo TRUE
fi
D.if [ $x == 10 && $y == 10 ]; then
echo TRUE
fi
E.if [ $x = 10 && $y = 10 ]; then
echo TRUE
fi
查看解析
标准答案
Please login to view
思路分析
We are evaluating which shell scripts correctly print TRUE when x and y are both equal to 10, considering how test ([ ]) works in POSIX shells and common bash syntax.
Option 1: if [ $x == 10 & $y == 10 ]; then echo TRUE fi
This uses == for string comparison and & as a background operator, not a logical AND inside [ ]. In many shells, [ ... ] with == is treated as a string comparison, which is acceptable, but the single & outside the test is a background operator that would separate commands, not combine the two tests. Moreove......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
Given the following shell variable assignments, a=6; b=10; c=15 Which of the following conditions is true?
Given the following shell variable assignments, a=2; b=5; c=10 Which of the following conditions is true?
Given the following shell variable assignments, a=10; b=5; c=3 Which of the following conditions is true?
The expression "if [ $count -gt 0 ]" checks if count is .....
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!