Ask Your Question
1

What is the method for utilizing a multiline command within "script:" using YAML?

asked 2022-03-11 11:00:00 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-26 19:00:00 +0000

djk gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-03-11 11:00:00 +0000

Seen: 9 times

Last updated: Aug 26 '21