Reference global credentials in Bash script in Jenkins job
<p>I created global credentials (username,password) and gave a custom ID. How do I reference this ID in my Bash script? I checked "inject global password" in my job configuration already.</p>

<p>I tried <a href="https://stackoverflow.com/questions/27152656/jenkins-access-global-passwords-in-powershell">Jenkins: Access global passwords in powershell</a> but doesn't work.</p>

<p>Assume the ID of the global credentials is "USER_PASSWORD", my bash script tried:</p>

<pre><code>echo ${USER_PASSWORD}
echo ${env:USER_PASSWORD}
</code></pre>

<p>Doesn't work. I read some online post I would need to query Jenkins API to get the credentials. That doesn't sound right.</p>