The following code is a very simplified version of my code just for a better explanation:
def String FOLDER_NAME = "TestFolder"
def createFolder() {
sh('''
ls
mkdir ${FOLDER_NAME}
ls
''')
}
I want to use the name, stored inside the FOLDER_NAME variable, to create a new folder. The problem is that the current code does not use it. My first approach was to use ' ' around the variable access like this:
def createFolder() {
sh('''
ls
mkdir '${FOLDER_NAME}'
ls
''')
}
But this creates a new folder called ${FOLDER_NAME} and does not use the variable value.
My question is, how do I have to change my code so that it uses the variable value, not the variable call?