可以嵌套 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