sh Bash Shell:找出变量是否为空 - 来自https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash Shell:找出变量是否为空 - 来自https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is相关的知识,希望对你有一定的参考价值。

if [ -z "$var" ]
then
      echo "\$var is empty"
else
      echo "\$var is NOT empty"
fi

以上是关于sh Bash Shell:找出变量是否为空 - 来自https://www.cyberciti.biz/faq/unix-linux-bash-script-check-if-variable-is的主要内容,如果未能解决你的问题,请参考以下文章