What does the script step "|2-" mean?


Lately the Bitrise WF gui editor reformats some of my script step with the “|2-” ‘formatting instruction’. It doesnt seem to affect the execution but I am wondering what it is meant to do. I am familiary with “|-” which I take to mean that the script contents are preformatted and not converted to a continuous string (i.e. Stop script step from reformatting the script contents)

- script@1:
    - content: |2-

        #!/usr/bin/env bash
        set -e +x

Does anybody have a link to what that string after the content line means? Should I start adopting that for all of my script step so they wont get reformatted ni the YML editor?



Hi @anuerind
Thank you for reaching out to Bitrise Support.
How long you are seeing that in your WF?
The lines after the content means -

It is an instance of a shebang line : the very first line in an executable plain-text file on Unix-like platforms that tells the system what interpreter to pass that file to for execution , via the command line following the magic #! prefix (called shebang ).

Yes, you should start adopting all of your scripts.




@chaitanya.tanna : i only noticed it last month. I am already familiar with the she-bang notation.

If I understood it correctly, the number is the actual line that is sent as the first line of the script? That implies that if my team is to ensure our workflows do not have unnecessary changes when versioning them we need to ensure that there is no empty space between the ‘content’ directive and the first line of our bash scripts.




Yes, that is correct @anuerind


1 Like