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