Last updated 5 years ago
Was this helpful?
可以嵌套 if/then 条件测试结构。嵌套的结果等价于使用 复合比较运算符。
if/then
a=3 if [ "$a" -gt 0 ] then if [ "$a" -lt 5 ] then echo "The value of \"a\" lies somewhere between 0 and 5." fi fi # 和下面的结果相同 if [ "$a" -gt 0 ] && [ "$a" -lt 5 ] then echo "The value of \"a\" lies somewhere between 0 and 5." fi
在 和 中展示了嵌套 if/then 条件测试结构。
&&