oderfla oderfla - 6 months ago 56
Bash Question

String parameter not working in jenkins shell

I create a new build with a parametrized string. The name fo the parameter is VERSION.

In the build I have this command:

sed -i -e 's/REPLACE_ME/$VERSION/g' config/config.json

The json file looks this way:

"ENV": {
"name": "test",
"version": "REPLACE_ME",

What happens is that REPLACE_ME is replaced by $VERSION.
I also tried with ${VERSION} but still no luck.
What am I doing wrong?


Surround your sed string with double quotes so that the variable is expanded properly.