1

I want to replace a string in Makefile by another one using sed:

* old string: $(ISM_DEPTH)/obj/lib/mylib.a
* new string: $(ENVIRONMENT_ROOT)/lib/

So, I used this command:

sed -e 's,$(ISM_DEPTH)/obj/lib/mylib.a,$(ENVIRONMENT_ROOT)/lib/,g' -i Makefile

The problem is that sed will replace $(ISM_DEPTH) and $(ENVIRONMENT_ROOT) by their values and I don't wont to do that.

ARM
  • 363
  • 1
  • 7
  • 18
  • Possible duplicate of [Difference between single and double quotes in bash](http://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash) – Benjamin W. Feb 29 '16 at 14:38

1 Answers1

1

You need to escape the $ character. To do so in Makefile it's needed to write double dollar - $$.:

sed -e 's,$$(ISM_DEPTH)/obj/lib/mylib.a,$$(ENVIRONMENT_ROOT)/lib/,g' -i Makefile
Zbynek Vyskovsky - kvr000
  • 18,186
  • 3
  • 35
  • 43