#Multiline shell script using SDKs

1 messages · Page 1 of 1 (latest)

thorny kernel
#

please is it possible to use multi line shell script with exec, e.g using python sdk. instead of using arrays of string

example using some CI

script:
    - """ line one
          line two
          line three
      """

instead of

container.with_exec(["command", "arg", "arg"])
subtle forge
#

Yes, the simplest way is to pass your script directly to a shell , for example:

container.with_exec([“sh”, “-c”, “””
  line one
  line two
  line three
“””])
#

This works well as long as your script is not too long. A few dozen lines is fine. Longer than that, then you should write the script to a file first, then execute the file