shell--字符串是否为空

b1=
b2=""
b3="hello"
if [[ -n "${b3}" ]]
then
    echo "not null"
else
    echo "null"
fi

b1     null

b2     null

b3     not null

-n str   字符串长度非零

原文地址:https://www.cnblogs.com/helloweworld/p/3781461.html