1109864Sjeff# $NetBSD: varname-dollar.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $ 2113357Sjeff# 3109864Sjeff# Tests for the expression "$$", which looks as if it referred to a variable, 4109864Sjeff# but simply expands to a single '$' sign. 5109864Sjeff# 6109864Sjeff# If there really were a special variable named '$', the expressions ${${DOLLAR}} 7109864Sjeff# and $$ would always expand to the same value. 8109864Sjeff 9109864Sjeff# Using the dollar sign in variable names is tricky and not recommended. 10109864Sjeff# To see that using this variable indeed affects the variable '$', run the 11109864Sjeff# test individually with the -dv option. 12109864SjeffDOLLAR= $$ 13109864Sjeff 14109864Sjeff# At this point, the variable '$' is not defined. Therefore the second line 15109864Sjeff# returns an empty string. 16109864Sjeff# expect+1: dollar is $. 17109864Sjeff.info dollar is $$. 18109864Sjeff# expect+1: dollar in braces is . 19109864Sjeff.info dollar in braces is ${${DOLLAR}}. 20109864Sjeff 21109864Sjeff# Now overwrite the '$' variable to see whether '$$' really expands to that 22109864Sjeff# variable, or whether '$$' is handled by the parser. 23109864Sjeff${DOLLAR}= dollar 24109864Sjeff 25109864Sjeff# At this point, the variable '$' is defined, therefore its value is printed 26109864Sjeff# in the second .info directive. 27116182Sobrien# expect+1: dollar is $. 28116182Sobrien.info dollar is $$. 29116182Sobrien# expect+1: dollar in braces is dollar. 30109864Sjeff.info dollar in braces is ${${DOLLAR}}. 31109864Sjeff 32109864Sjeffall: 33109864Sjeff @:; 34109864Sjeff