azureazure-pipelines

Azure Pipeline - Write a file with break points


In script task, i want to write a new file contains break line (\n) on ubuntu machine. I tried many things like that:

- task: Bash@3
  inputs:
    targetType: 'inline'
    script: |
      cd $(PROJECT_DIRECTORY) # --no-codesign
      #echo "storePassword=$(keystore-password)\\n keyPassword=$(key-password)\n keyAlias=$(key-alias)\\n storeFile=./upload-keystore.jks" > MyFile.txt
      echo 'David: cat MyFile.txt' && cat MyFile.txt

But it write \n and not a break line.


Solution

  • Did you test this with -e -flag? I think that should work.

    Such as echo -e "storePassword=test\n keyPassword=test\n keyAlias=test\\n storeFile=./upload-keystore.jks" > MyFile.txt