1 1.3 rillig # $NetBSD: varname-dollar.mk,v 1.3 2020/08/19 05:40:06 rillig Exp $ 2 1.1 rillig # 3 1.2 rillig # Tests for the expression "$$", which looks as if it referred to a variable, 4 1.2 rillig # but simply expands to a single '$' sign. 5 1.3 rillig # 6 1.3 rillig # If there really were a special variable named '$', the expressions ${${DOLLAR}} 7 1.3 rillig # and $$ would always expand to the same value. 8 1.3 rillig 9 1.3 rillig # Using the dollar sign in variable names is tricky and not recommended. 10 1.3 rillig # To see that using this variable indeed affects the variable '$', run the 11 1.3 rillig # test individually with the -dv option. 12 1.3 rillig DOLLAR= $$ 13 1.3 rillig 14 1.3 rillig # At this point, the variable '$' is not defined. Therefore the second line 15 1.3 rillig # returns an empty string. 16 1.3 rillig .info dollar is $$. 17 1.3 rillig .info dollar in braces is ${${DOLLAR}}. 18 1.3 rillig 19 1.3 rillig # Now overwrite the '$' variable to see whether '$$' really expands to that 20 1.3 rillig # variable, or whether '$$' is handled by the parser. 21 1.3 rillig ${DOLLAR}= dollar 22 1.1 rillig 23 1.3 rillig # At this point, the variable '$' is defined, therefore its value is printed 24 1.3 rillig # in the second .info directive. 25 1.3 rillig .info dollar is $$. 26 1.3 rillig .info dollar in braces is ${${DOLLAR}}. 27 1.1 rillig 28 1.1 rillig all: 29 1.1 rillig @:; 30