所以在詹金斯我正在做以下事情
cert = sh(returnStdout: true, script: "cat cert.json")
sh "sed -i '0,/content:.*/s//content: $cert/g' example.yaml"
因此,当 sed 命令替换
$cert
并将 /g' example.yaml
放在新行上时,这会破坏 sed 命令,从而导致
sed:-e 表达式 #1,字符 7486:未终止的 `s' 命令
如何解决此问题,以便
/g' example.yaml
不在新行上
通过在末尾添加 .trim() 解决了它