莫激动 发表于 2013-2-4 13:01:24

shell中判断变量为null

在shell 中判断变量为null
方法一:
 

if [ $x ];then   echo 'not null'else   echo 'is null'fi 
方法二:
 

if [ -z "$x" ];   echo 'is null'else   echo 'not null'fi 
 
页: [1]
查看完整版本: shell中判断变量为null