Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a couple of methods for utilizing a multiline command within "script:" using YAML:

  1. Use the pipe (|) or folded style (>) scalar block styles to preserve newlines and allow multiline commands. For example:
script:
  - |
    echo "This is a 
    multiline 
    command."

or

script:
  - >
    echo "This is a 
    multiline 
    command."
  1. Use the > scalar block style with the | literal block scalar to allow multiline commands and remove newlines. For example:
script:
  - >-
    echo "This is a 
    multiline 
    command."

Both methods allow for multiline commands to be utilized within "script:" using YAML, but choosing the appropriate method depends on whether or not newlines need to be preserved or removed.