问题描述
我正在尝试在Jenkins构建过程中运行以下shell命令
I am trying to run the following shell command with Jenkins build process
mv !(build) build
现在,构建失败说
$ /bin/bash -xe /tmp/jenkins2925091423898519645.sh
/tmp/jenkins2925091423898519645.sh: line 2: syntax error near unexpected token `('
但是奇怪的是,当直接在Jenkin从站上运行此命令时,它可以正常工作.
But the strange thing is, when running this command directly on a Jenkin slave, it works fine.
如您所见,Jenkins也使用 /bin/bash -xe
运行shell命令.
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
推荐答案
!(build)
是由shopt -s extglob
启用的扩展模式.目前尚不清楚如何在您的Jenkins奴隶中启用它,但是将该命令添加到脚本中应该可以解决您的问题.
!(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.
这篇关于带有mv!(build)的意外令牌`('附近的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!