shell中如何比较两字符串是否相等
展开全部
#!/bin/bash
a="abc"
b="def"
if [ "$a" = "$b" ]
then
echo " a is same as b"
else
echo "a is different from b"
fi
a="abc"
b="def"
if [ "$a" = "$b" ]
then
echo " a is same as b"
else
echo "a is different from b"
fi
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#!/bin/bash
#filename is diffs.sh
if [ $# != 2 ];
then
echo "usage:./diffs.sh text1 text2"
elif [ $1 = $2 ];
then
echo " Text1 is same as Text2"
else
echo "Text1 is different from Text2"
fi
#filename is diffs.sh
if [ $# != 2 ];
then
echo "usage:./diffs.sh text1 text2"
elif [ $1 = $2 ];
then
echo " Text1 is same as Text2"
else
echo "Text1 is different from Text2"
fi
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
A="string1"
B="string2"
if [ $A = $B ]
then
echo "$A eq $B"
else
echo "$A ne $B"
fi
B="string2"
if [ $A = $B ]
then
echo "$A eq $B"
else
echo "$A ne $B"
fi
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
shell是什么意思?是c#语言吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询