sh Bash - 样本If-Then - 来自http://tldp.org/LDP/abs/html/nestedifthen.html

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash - 样本If-Then - 来自http://tldp.org/LDP/abs/html/nestedifthen.html相关的知识,希望对你有一定的参考价值。

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

# Same result as:

if [ "$a" -gt 0 ] && [ "$a" -lt 5 ]
then
  echo "The value of \"a\" lies somewhere between 0 and 5."
fi

以上是关于sh Bash - 样本If-Then - 来自http://tldp.org/LDP/abs/html/nestedifthen.html的主要内容,如果未能解决你的问题,请参考以下文章