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
在shell 中判断变量为null
方法一:
if [ $x ];then
echo 'not null'
else
echo 'is null'
fi
方法二:
if [ -z "$x" ];
echo 'is null'
else
echo 'not null'
fi
暂无评论。
评论功能维护中,当前仅展示历史评论。