shell空参检测

如果传参是空的

可以采用如下的检测方式:
if [ "X$1" = "X" ]

if [[ x$1 = x ]];
then
      echo "参数为空"
else
      echo "参数不为空"
fi

references:
“X$1”=”X” what it does