Reputation: 548
I am trying to set a environment variable to a http request header. For example
""" --header 'Authorization: "${auth}"' """
But probaly due to the quote '...', the ${auth} is not correctly set.
A simple example:
job(jobName) {
wrappers {
environmentVariables {
env('auth', 'something I want to set')
}
}
steps {
shell(''' echo "${auth}" ''')
}
}
my test:
shell(''' echo "${auth}" ''') --> correctly echo
shell(''' echo '"${auth}"' ''') --> not echo correctly
shell(""" echo '"${auth}"' """) --> not echo correctly
Upvotes: 2
Views: 1678
Reputation: 5887
per-character escaping: \"
~ auth="test"
~ echo "\"${auth}\""
"test"
concatenation: '"'
${auth}
'"'
~ echo '"'${auth}'"'
"test"
Upvotes: 1