github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/src/com/sap/piper/BashUtils.groovy (about) 1 package com.sap.piper 2 3 class BashUtils implements Serializable { 4 static final long serialVersionUID = 1L 5 public static final String ESCAPED_SINGLE_QUOTE = "'\"'\"'" 6 7 /** 8 * Put string in single quotes and escape contained single quotes by putting them into a double quoted string 9 */ 10 static String quoteAndEscape(String str) { 11 def escapedString = str.replace("'", ESCAPED_SINGLE_QUOTE) 12 return "'${escapedString}'" 13 } 14 }