Shell 字符串比较
#! /bin/sh
str1="loving you too"
str2='loving you'
if [ str1=str2 ]
then
echo "true"
else
echo "false"
fi
if [ "$str1"="$str2" ]
then
echo "true"
else
echo "false"
fi
if [ \$str1=\$str2 ]
then
echo "true"
else
echo "false"
fi
echo $str1 #loving you too
echo $str2 #loving you
exit 0
为什么都是true呢?
who can tell me?