Apr 30 2024 03:56 PM - edited Apr 30 2024 03:58 PM
I have a txt file and I'm trying to save all the content in a variable but I'm only getting the first line of the content into the variable
greetings.txt
- hello: 123 - hello: 456 - hello: 789
azure-pipeline.yml
variables: - name: MY_TEXT_FILE value: 'greetings.txt' readonly: true # Save text file content 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"
Results after 'Another task' is executed:
Actual results:
- hello: 123
Expected results:
- hello: 123 - hello: 456 - hello: 789
What I need to update so I can get the expected results?