Azure Pipelines`-script:...
我正在寻找一种制作多行脚本的方法:
steps:
- script: >
echo foo
bar
结果:
foobar
没有空间或新线。
在实际情况下,我正在定义一个类似的变量:
- script: >
echo
"##vso[task.setvariable variable=packageVersion]
some_very_long_awk_code_to_generate_a_3_digit_number"
此问题导致它包含一个空间,因此存储的变量将变为some_very _..vey _...
(请注意开始时的空间)。 “>”脚本旁边会添加有新线的空间,但是似乎没有任何方法可以在没有空间或新线的情况下加入它。
有关Yaml Multiline Code 的解释解释它应该如下:
steps:
- script: >
echo foo\
bar
,这也会导致:
foo bar
不幸的是:不幸的是 Quote:
steps:
- script: >
echo "foo\
bar"
将导致:
foo\ bar
I am looking for a way to make a multiline script like:
steps:
- script: >
echo foo
bar
result in:
foobar
with no spaces or newlines.
In the real-world scenario I am defining a variable like so:
- script: >
echo
"##vso[task.setvariable variable=packageVersion]
some_very_long_awk_code_to_generate_a_3_digit_number"
This issue is causing it to include a space, so the stored variable will become some_very_...
(note the space at the start). The ">" next to the script will add spaces where there are newlines, but there seems to be no method to just join it without a space or newline.
This explanation about YAML multiline code explains that it should work as follows:
steps:
- script: >
echo foo\
bar
Unfortunately, this also results in:
foo bar
Performing it with a double quote:
steps:
- script: >
echo "foo\
bar"
will result in:
foo\ bar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档 YAML多行代码用于参数,但这在输出语法
echo
中不起作用。当您使用启动器pipline创建默认的yaml管道时:
尝试使用以下脚本:
The document about YAML multiline code is used for parameter, but this doesn't work in the output syntax
echo
.And when you create a default YAML pipeline with Starter piepline:
There is a demo code about multi-line script:
So, if you want make a multiline script, you could try to use below scripts: