无法在jenkinsgroovy管道(cat EOF)中创建文件



我想在jenkinsgroovy管道(RHELSlave(中创建包含内容的文件。

现在我使用这个命令

steps {
script {
sh """
cat <<EOF >>file.sh
echo 'Hello world'
EOF
"""
}    
}
}

但我是在詹金斯工作的时候收到这个消息的。

2022-09-27 21:21:06  /apps/jenkins/workspace/xxxx/xxxxxx@tmp/durable-aa115c9c/script.sh: line 7: warning: here-document at line 2 delimited by end-of-file (wanted `EOF')
2022-09-27 21:21:06  + cat

我已经检查了EOF的空间,但仍然没有工作。

请帮忙建议。

做下面这样的事情不是很容易吗?只需将STDOUT重定向到一个文件。

sh """
echo 'Hello world' >> file.sh
echo 'Hello Something' >> file.sh
"""

最新更新