[英]export command not working in Jenkins groovy
export vara=$(grep '<Pattern>' $some_path/config/...../coreapplication_obips1/instanceconfig.xml | awk -F \> '{print $3}' | awk -F \< '{print $1}')
I am trying the above code in Jenkins pipeline using groovy script. 我正在使用groovy脚本在Jenkins管道中尝试上述代码。 It throws below error: 它抛出以下错误:
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310
How to execute shell script inside Jenkins groovy? 如何在Jenkins Groovy中执行Shell脚本?
Refer the below to run shell and capture the output to a variable inside a Jenkins groovy file:- 请参考以下内容运行shell并将输出捕获到Jenkins groovy文件内的变量中:
vara = sh (script: 'shell script need to be executed', returnStdout: true)
You can try something like this:- 您可以尝试这样的事情:
steps {
script {
vara = sh (script: '''shell command''', returnStdout: true)
echo " The value of variable id ${vara}"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.