Sample Header Ad - 728x90

mk, sed, and embedding environment variables

1 vote
2 answers
2216 views
When using mk , GNU sed, I find that variables do not expand at all. Problematic code: VAR=qux ... build: sed -i "s|FOO = .*|FOO = $VAR|" bar.file This seems to run the following: sed -i "s|FOO = .*|FOO = $VAR|" bar.file when I want it to run sed -i "s|FOO = .*|FOO = qux|" bar.file I have tried using single quotes and double quotes, as other stack exchange posts have mentioned. The only instance I can get $VAR to expand is when there are no quotes around it. Which of course means that sed no longer sees the expression as an expression.
Asked by Aster (121 rep)
Aug 20, 2017, 01:18 AM
Last activity: Aug 21, 2017, 11:21 AM