I try to run shell command in my Bamboo plan. This is my code I try to run:
[ "$(git rev-parse --abbrev-ref HEAD)" == *test* ] || [ "$(git rev-parse --abbrev-ref HEAD)" == *develop* ] && echo "yes"
That should check branch name is test
or develop
. If it is, then it should print message yes
.
I run this on branch develop
, then I got error.
Error message:
[: develop: unexpected operator
UPDATE:
This is POSIX so based on a post:
String comparison in bash. [[: not found
I replaced ==
with a single =
.
So my command looks:
[ "$(git rev-parse --abbrev-ref HEAD)" = *test* ] || [ "$(git rev-parse --abbrev-ref HEAD)" = *develop* ] && echo "yes"
Error messaage I got:
[: pytest.ini: unexpected operator
No idea what is pytest.ini is doing here. My application using pytest but in this step I didn't run it.