1*956e45f6SSimon J. Gerraty# $NetBSD: varmod-quote.mk,v 1.3 2020/10/29 19:07:45 rillig Exp $ 22c3632d1SSimon J. Gerraty# 32c3632d1SSimon J. Gerraty# Tests for the :Q variable modifier, which quotes the variable value 42c3632d1SSimon J. Gerraty# to be used in a shell program. 52c3632d1SSimon J. Gerraty 6*956e45f6SSimon J. Gerraty# Any characters that might be interpreted by the shell are escaped. 7*956e45f6SSimon J. Gerraty# The set of escaped characters is the same, no matter which shell (sh, csh, 8*956e45f6SSimon J. Gerraty# ksh) is in effect. 9*956e45f6SSimon J. Gerraty.if ${:Ua b c:Q} != "a\\ b\\ c" 10*956e45f6SSimon J. Gerraty. error 11*956e45f6SSimon J. Gerraty.endif 12*956e45f6SSimon J. Gerraty 13*956e45f6SSimon J. Gerraty# The quote modifier only applies if the whole modifier name is "Q". 14*956e45f6SSimon J. Gerraty# There is no "Qshell" or "Qawk" or "Qregex" or even "Qhtml" variant. 15*956e45f6SSimon J. Gerraty# All strings except the plain "Q" are interpreted as SysV modifier. 16*956e45f6SSimon J. Gerraty.if ${:Ua.Qshell:Qshell=replaced} != "a.replaced" 17*956e45f6SSimon J. Gerraty. error 18*956e45f6SSimon J. Gerraty.endif 192c3632d1SSimon J. Gerraty 202c3632d1SSimon J. Gerratyall: 212c3632d1SSimon J. Gerraty @:; 22