linux shell中的如下比较字符串为什么比较不出来?
if["X$line"="X[$blockname]"];thenbegin_block=1#echo"3"continuefi如下是我打出来的X$line和X[$blo...
if [ "X$line" = "X[$blockname]" ];then
begin_block=1
#echo "3"
continue
fi
如下是我打出来的X$line和X[$blockname]的值
X[GroupM] X[GroupS]
X#ha group0 infor: 0:enable 1:disable X[GroupS]
Xha-enable=1 X[GroupS]
X#keepalive-interval,value must be in <500-60000> X[GroupS]
Xkeepalive-interval=1000 X[GroupS]
X# retry-times,value must be in <1-10> X[GroupS]
Xretry-times=3 X[GroupS]
X# device-priority,value must be in <1-255> X[GroupS]
Xdevice-priority=128 X[GroupS]
X#haifname,value must be ha or ethernet name X[GroupS]
Xhaifname=ha X[GroupS]
X#prempt, value must be in <0-1> X[GroupS]
Xprempt=0 X[GroupS]
X# configuration-synchronization ,value must be in <0-1> X[GroupS]
Xconfiguration-synchronization=0 X[GroupS]
X# user-synchronization ,value must be in <0-1> X[GroupS]
Xuser-synchronization=0 X[GroupS]
X[GroupS] X[GroupS]----这一行是完全一样的,为什么始终进不了if条件分支?
X#ha group0 infor: 0:enable 1:disable X[GroupS]
Xha-enable=0 X[GroupS]
Xkeepalive-interval=1000 X[GroupS]
Xretry-times=3 X[GroupS]
Xdevice-priority=128 X[GroupS]
Xhaifname=ha X[GroupS]
Xprempt=0 X[GroupS]
Xconfiguration-synchronization=0 X[GroupS]
Xuser-synchronization=0 X[GroupS] 展开
begin_block=1
#echo "3"
continue
fi
如下是我打出来的X$line和X[$blockname]的值
X[GroupM] X[GroupS]
X#ha group0 infor: 0:enable 1:disable X[GroupS]
Xha-enable=1 X[GroupS]
X#keepalive-interval,value must be in <500-60000> X[GroupS]
Xkeepalive-interval=1000 X[GroupS]
X# retry-times,value must be in <1-10> X[GroupS]
Xretry-times=3 X[GroupS]
X# device-priority,value must be in <1-255> X[GroupS]
Xdevice-priority=128 X[GroupS]
X#haifname,value must be ha or ethernet name X[GroupS]
Xhaifname=ha X[GroupS]
X#prempt, value must be in <0-1> X[GroupS]
Xprempt=0 X[GroupS]
X# configuration-synchronization ,value must be in <0-1> X[GroupS]
Xconfiguration-synchronization=0 X[GroupS]
X# user-synchronization ,value must be in <0-1> X[GroupS]
Xuser-synchronization=0 X[GroupS]
X[GroupS] X[GroupS]----这一行是完全一样的,为什么始终进不了if条件分支?
X#ha group0 infor: 0:enable 1:disable X[GroupS]
Xha-enable=0 X[GroupS]
Xkeepalive-interval=1000 X[GroupS]
Xretry-times=3 X[GroupS]
Xdevice-priority=128 X[GroupS]
Xhaifname=ha X[GroupS]
Xprempt=0 X[GroupS]
Xconfiguration-synchronization=0 X[GroupS]
Xuser-synchronization=0 X[GroupS] 展开
1个回答
TableDI
2024-07-18 广告
2024-07-18 广告
在Excel中,字符串匹配函数主要用于查找和定位特定字符串在文本中的位置或进行替换操作。常用的字符串匹配函数包括FIND、SEARCH、SUBSTITUTE和REPLACE等。FIND和SEARCH函数用于查找字符串的位置,而SUBSTIT...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询