本文介绍了带有mv!(build)的意外令牌`('附近的语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试在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)的意外令牌`('附近的语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 11:57