意外的运算符-Bamboo计划中的Shell脚本

问题描述

我尝试在Bamboo计划中运行shell命令。 这是我尝试运行的代码:

[ "$(git rev-parse --abbrev-ref HEAD)" == *test* ] || [ "$(git rev-parse --abbrev-ref HEAD)" == *develop* ] && echo "yes"

应检查分支名称为testdevelop。如果是,那么它应该显示消息yes

我在分支develop上运行此命令,然后出现错误。

错误消息: [: develop: unexpected operator


更新:

这是POSIX,因此基于帖子: String comparison in bash. [[: not found 我用单个==取代了=

所以我的命令看起来:

[ "$(git rev-parse --abbrev-ref HEAD)" = *test* ] || [ "$(git rev-parse --abbrev-ref HEAD)" = *develop* ] && echo "yes"

我得到的错误消息: [: pytest.ini: unexpected operator

不知道pytest.ini在这里做什么。 我的应用程序使用pytest,但是在这一步中我没有运行它。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)