I am trying to run the following shell command with Jenkins build process
mv !(build) build
Now the build fails saying
$ /bin/bash -xe /tmp/jenkins2925091423898519645.sh
/tmp/jenkins2925091423898519645.sh: line 2: syntax error near unexpected token `('
But the strange thing is, when running this command directly on a Jenkin slave, it works fine.
As you can see, Jenkins run the shell commands with /bin/bash -xe
as well.
Any help would be appreciated because i am struggling with this for hours
A parse error: syntax error, unexpected appears when the PHP interpreter detects a missing element. Most of the time, it is caused by a missing curly bracket “}”. To solve this, it will require you to scan the entire file to find the source of the error.
This error message also surfaces when you are entering commands in the Linux command line for everyday tasks such as copying files manually etc. The main reasons why this error message occurs is either because of bad syntax or problem of the OS in interpreting another system's commands/shell.
!(build)
is an extended pattern, enabled by shopt -s extglob
. It's not clear how it's being enabled in your Jenkins slave, but adding that command to your script should solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With