Shell脚本字符串

时间:2018-07-15 11:30:37

标签: string shell

我实际上grep从文件中获取一行,并将该行存储为字符串。 当我将该字符串与相似的字符串(与其他字符串完全相同)进行比较时,由于两者相等,我没有得到结果。

请帮助。

#!/bin/bash

ref="BIP1295I: Integration node 'IB10NODEQ03' is an active multi-instance or High Availability integration node that is running on queue manager 'IB10QMGRQ03'."

message1=$(mqsilist| grep IB10NODEQ03 2>&1)

echo $message1
echo $ref

if [ "$message1" = "$ref" ]; then
echo "equal"
else
echo "not equal"
fi

执行脚本

[mqbrkrs@dclqsa80 /tmp]$ sh script*
BIP1295I: Integration node 'IB10NODEQ03' is an active multi-instance or High Availability integration node that is running on queue manager 'IB10QMGRQ03'.
BIP1295I: Integration node 'IB10NODEQ03' is an active multi-instance or High Availability integration node that is running on queue manager 'IB10QMGRQ03'.
not equal

0 个答案:

没有答案