1 1.4 rillig # $NetBSD: varname-dollar.mk,v 1.4 2023/06/01 20:56:35 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.4 rillig # expect+1: dollar is $. 17 1.3 rillig .info dollar is $$. 18 1.4 rillig # expect+1: dollar in braces is . 19 1.3 rillig .info dollar in braces is ${${DOLLAR}}. 20 1.3 rillig 21 1.3 rillig # Now overwrite the '$' variable to see whether '$$' really expands to that 22 1.3 rillig # variable, or whether '$$' is handled by the parser. 23 1.3 rillig ${DOLLAR}= dollar 24 1.1 rillig 25 1.3 rillig # At this point, the variable '$' is defined, therefore its value is printed 26 1.3 rillig # in the second .info directive. 27 1.4 rillig # expect+1: dollar is $. 28 1.3 rillig .info dollar is $$. 29 1.4 rillig # expect+1: dollar in braces is dollar. 30 1.3 rillig .info dollar in braces is ${${DOLLAR}}. 31 1.1 rillig 32 1.1 rillig all: 33 1.1 rillig @:; 34