Today I Learned

hashrocket A Hashrocket project

Escape $ dollar sign on Makefiles

I just learned that if you want to use a dollar sign inside a Makefile you need to escape $ with an extra $, so double it. Otherwise make will think that you are accessing a make variable, not a shell one.

on shell:

for i in *; do echo "i=$i"; done

on Makefile:

	for i in *; do echo "i=$$i"; done

Here’s a reference

See More #command-line TILs