我在 bash 上尝试了以下命令
echo this || echo that && echo other
这给出了输出
this
other
我不明白!
我的试运行是这样的:
echo this || echo that && echo other暗示true || true && true- 因为,
&&hasmore precedencethan||, 第二个表达式首先计算 - 因为,
both are true,||被评估,这也给出了真实的。 - 因此,我得出的结论是:
那
其他
这
&&来自优先级高于的 Java 背景||,我无法将其与 bash 联系起来。
任何输入都会非常有帮助!