shell 字符串比较是否相等 报错[: =: unary operator expected
egg:
a = '123'
b='1234'
if [ $a == $b ];then
echo "相等"
fi
此时报错[: =: unary operator expected
正确写法 多加个[ ]:
if [[ $a == $b ]];then
echo "相等"
fi
shell 字符串比较是否相等 报错[: =: unary operator expected
egg:
a = '123'
b='1234'
if [ $a == $b ];then
echo "相等"
fi
此时报错[: =: unary operator expected
正确写法 多加个[ ]:
if [[ $a == $b ]];then
echo "相等"
fi