Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update src/main/resources/org/jenkinsci/plugins/workflow/steps/durabl…
…e_task/ShellStep/help-script.html

Co-authored-by: A. Jard <[email protected]>
  • Loading branch information
Queen-esther01 and aHenryJard authored Apr 26, 2021
commit 1e9657fd4a8ed209bb7a06bf53817ef856f5b503
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@

<b>Running tests in the same workspace that the project was built </b>
<p><code>sh 'mvn test'</code></p>

<b>Using multi-line syntax to run several lines of script:</b>
<p>
<pre>
sh '''
echo "This is a first line of script"
# This is a script comment
echo "This is a second line"
'''
</pre>
</p>
<b>Escaping script content from groovy interpretation </b>>
<p>The triple-double-quote (""") string literal syntax allows for variable/expression substitution (interpolation), so the backslash (\) is interpreted as a special character "escape".</p>
<p>Since the first open parentheses is not such a special character, Groovy compilation fails. If your intent is to have literal backslashes in the resulting string, you need to escape the backslashes. That is, use a double-backslash (\\) to substitute for one literal backslash</p>
Expand All @@ -38,4 +47,4 @@
<p>So you need to escape all $ if you use double quotes or simply use single quotes which does not support interpolation</p>
<p><code>sh(returnStdout: true, script: "cd \$it; PLAN=\$(terragrunt plan --terragrunt-source-update | landscape);
echo \$PLAN; CHANGES=\$(echo \$PLAN | tail -2); echo \$CHANGES"</code></p>
</div>
</div>