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