情况:
我需要在Jenkins的多分支管道中执行此命令:
find . -name '*.py' -exec echo Executing {} \; -exec python {} \; -exec echo Executed Successfully {} \;
在我的jenkinsfile中,我有:
steps {
sh '''
#!/bin/bash
find . -name '*.py' -exec echo Executing {} \; -exec python {} \; -exec echo Executed Successfully {} \;
'''
}
我总是使用此机制执行sh
命令,但此行失败:
WorkflowScript: 12: unexpected char: '\' @ line 12, column 69.
*.py' -exec echo Executing {} \; -exec p
^
此行可在我的本地控制台中正常使用。
问题:
如何在我的Jenkinsfile中使用它?
我已经尝试过:
sh 'find . -name '*.py' -exec echo Executing {} \; -exec python {} \; -exec echo Executed Successfully {} \;'
sh "find . -name '*.py' -exec echo Executing {} \; -exec python {} \; -exec echo Executed Successfully {} \;"
但是它总是失败。