Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 在Jenkin管道中运行shell脚本时出错_Angular_Shell_Jenkins_Groovy_Build - Fatal编程技术网

Angular 在Jenkin管道中运行shell脚本时出错

Angular 在Jenkin管道中运行shell脚本时出错,angular,shell,jenkins,groovy,build,Angular,Shell,Jenkins,Groovy,Build,我需要从目录中删除所有文件,除了和变量中定义的名称匹配的文件 stage ('build'){ sh "npm run build" sh 'rm -v !(''''dist/folder1/file.''' + name+ '''.json'''')' } 第一行为angular项目创建一个构建,它有一个dist文件夹,我需要

我需要从目录中删除所有文件,除了和变量中定义的名称匹配的文件

                stage ('build'){
                        sh "npm run build"
                        sh 'rm -v !(''''dist/folder1/file.''' + name+ '''.json'''')'
                    }
第一行为angular项目创建一个构建,它有一个dist文件夹,我需要在其中删除folder1中的文件

错误如下


语法错误:“(“使用rm exclude file命令时出现意外错误”

错误详细信息和可供选择的解决方案。请尝试以下代码:

sh "find . ! -name 'file.${name}.json' -type f -exec rm -f {} +"

我尝试了它,但它也给出了同样的错误。Script。SH:语法错误:“(用Noch>)的转义字符(No.<代码)>我不能用HealthChar()使用,因为没有这个,它就被考虑为ch.char作为目录的一部分。使用escape char后,jenkins管道工作流脚本中出现以下错误:102:意外字符:'\'谢谢,它工作正常。感谢您的帮助。我接受您的答案。