#lazyweb Weird thing. When using `sed` in a makefile context, its seems to behave slightly different than expected, as explained in [1]. More precise: To capture the end of a line, you normally use $ as the last character in the search expression, but in a makefile context it somehow needs $$. The linked post explains *THAT* it works this way but not *WHY*. This upsets me ;) Can anyone explain what is going on here?
@jwildeboer The backslash is interpreted by the shell, the single "$" is interpreted (consumed) by make, as it tries to access a variable $" (dollar-sign, followed by double-quote). To echo a "$", you need to:
1. Escape using "\" for the shell 2. Escape using "$$" for make
Note how the make output of the first file is just the line:
@joostvb Got that (and actually knew that, but is was deeply buried in my brain) I just missed the mental connection as I saw this syntax in a docker compose file :)
Thank you for the replies and explanations! Variable expansion in makefiles is the answer. Why I saw that syntax in a docker compose file is now the next question. I *guess* because it does a similar thing wrt variable expansion before handing the sed command to be executed, but I am not that much of a docker expert.