Pass groovy variable to shell script

added the single quotes and plus operater('+ variable +') around the variable. Now it is working

svn copy '''+svnSourcePath+' '+svnDestPath+''' -m 'promote dev to test' --username $SVN_USER --password $SVN_PWD '''

You can use """ content $var """. """ allows string interpolation in the here doc; ''' does not.


+1 to Selvam answer

following is my use case with parameter plugin

String parameter name: pipelineParameter

Default value: 4

node {
  stage('test') {
        withCredentials([[...]]) {
          def pipelineValue = "${pipelineParameter}"  //declare the parameter in groovy and use it in shellscript
          sh '''
             echo '''+pipelineValue+' abcd''''
             '''
        }
}}

The above prints 4 abcd