Prevent GNU use from expanding dollar signs in environment variables

Is there a way for GNU to make the interpretation of dollar signs literally in environment variables?

Take this makefile:

echoFOO:
        echo '$(FOO)'

      

Run it like this:

$ FOO='a$bc' make
echo 'ac'
ac

      

I wish this would literally pronounce the letter $ bc, but I can't seem to find a way to get GNU Make to save its damn hands from environment variables.

+3


source to share


1 answer


Two ways to get the result you want to see. Compromises with both.



$ cat Makefile
all: echoFOO echovFOO

echoFOO:
        echo '$(FOO)'

echovFOO:
        echo '$(value vFOO)'
$ FOO='a$$bc' vFOO='a$bc' make
echo 'a$bc'
a$bc
echo 'a$bc'
a$bc

      

+2


source







All Articles