# Jenkins Credential Interpolation issue within shell script

**URL:** <https://community.jenkins.io/t/jenkins-credential-interpolation-issue-within-shell-script/8432>\
**Category:** Ask a question\
**Tags:** question\
**Created:** [July 12, 2023, 6:25am UTC](https://community.jenkins.io/t/jenkins-credential-interpolation-issue-within-shell-script/8432 "2023-07-12T06:25:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RajatJ](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@RajatJ](https://community.jenkins.io/u/RajatJ)\
**Post date:** [July 12, 2023, 6:25am UTC](https://community.jenkins.io/t/jenkins-credential-interpolation-issue-within-shell-script/8432/1 "2023-07-12T06:25:27Z")

</div>

Hi All,  
Recently we had upgraded our Jenkins version from 2.375.3-lts to 2.401.1-lts, After the upgrade was complete we saw failure on our pipelines in cases where we were using a withCredentials block, an example snippet :  
`withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ sh('curl --request GET www.example.com -u $USER:$PASS --output resp') }`  
When we try to run this specific code snippet in any pipeline, we noticed that the values for the credential variables USER and PASS were not being interpolated to the shell script command and instead we just get an empty user and pass field in the console log during execution.

We didn’t have this issue with version 2.375.3-lts and are unable to link it specifically to any other plugins, has anyone encountered a similar issue? If so, how did you manage to fix it?

---

<div class="post-metadata">

**Author:** ![daotoan-hd](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/daotoan-hd/32/4716_2.png) [@daotoan-hd](https://community.jenkins.io/u/daotoan-hd)\
**Post date:** [July 15, 2023, 7:27am UTC](https://community.jenkins.io/t/jenkins-credential-interpolation-issue-within-shell-script/8432/2 "2023-07-15T07:27:42Z")

</div>

Hi,  
Your code does not follow Groovy Interpolation  
please change `'` → `"`  
From:

```auto
    withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ 
        sh('curl --request GET www.example.com -u $USER:$PASS --output resp') 
    }

```

To:

```auto
    withCredentials([usernamePassword(credentialsId: 'creds-id', usernameVariable: 'USER', passwordVariable: 'PASS')]){ 
        sh("curl --request GET www.example.com -u $USER:$PASS --output resp") 
    }

```
