Reputation: 1224
I have one variable in app.js called
process.env.NODE_ENV = 'development';
i tried sed command to replace the value from development to production.
sed -i -e "s/process.env.NODE_ENV = \'development\';/process.env.NODE_ENV = \'production\';/g" app.js
But it didnt work. How to change the value in app.js file.
Upvotes: 1
Views: 1567
Reputation: 498
As you use double quotes, the backslashes get interpreted by your shell. You can see that with set -x
. The interpreted command which is called looks like:
sed -i -e 's/process.env.NODE_ENV = \'\''development\'\'';/process.env.NODE_ENV = \'\''production\'\'';/g' app.js
If you remove the backslashes, it works.
Upvotes: 1