Issue
In my Groovy Jenkins pipeline, I have the following:
sh(script: """#!/bin/bash
set -ex
echo 'sometext' > test1.txt
""")
But in the Jenkins logs, it looks like this:
[Pipeline] script
[Pipeline] {
[Pipeline] sh
11:43:28 + echo sometext
That is, it seems to ignore the ">" operator completely. Is there something I'm doing wrong with the escaping?
Solution
i think that's how -x
prints the commands into output
try
set -ev
instead of
set -ex
https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
-v
Print shell input lines as they are read.
Answered By - daggett