我有一只 t子,一米试图在变数中挽救所有内容,但我只想把内容的第一行带上变数。
greetings.txt
- hello: 123
- hello: 456
- hello: 789
azure-line.yml
variables:
- name: MY_TEXT_FILE
value: greetings.txt
readonly: true
# Save text file in this variable
- name: GREETINGS_CONTENT
value:
steps:
- task: Bash@3
displayName: Save text file content in a variable
inputs:
targetType: inline
script: |
echo "##vso[task.setvariable variable=GREETINGS_CONTENT]$(cat $MY_TEXT_FILE)"
- task: Bash@3
displayName: Another task
inputs:
targetType: inline
script: |
# This is only printing the first line of the txt file
# I want to save ALL the txt file content in the variable
echo "My greetings are: $GREETINGS_CONTENT"
页 次 执行另一项任务:
Actual results:
- hello: 123
<>>预期成果:
- hello: 123
- hello: 456
- hello: 789
我需要更新什么才能取得预期结果?