1# $NetBSD: varmod-shell.mk,v 1.6 2021/02/14 20:16:17 rillig Exp $
2#
3# Tests for the ':!cmd!' variable modifier, which runs the shell command
4# given by the variable modifier and returns its output.
5#
6# This modifier has been added on 2000-04-29.
7#
8# See also:
9#	ApplyModifier_ShellCommand
10
11# The command to be run is enclosed between exclamation marks.
12# The previous value of the expression is irrelevant for this modifier.
13# The :!cmd! modifier turns an undefined expression into a defined one.
14.if ${:!echo word!} != "word"
15.  error
16.endif
17
18# If the command exits with non-zero, an error message is printed.
19# XXX: Processing continues as usual though.
20#
21# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
22# value of the expression (which is usually an empty string) instead of the
23# command that was executed.  It's strange that such a simple bug could
24# survive such a long time.
25.if ${:!echo word; false!} != "word"
26.  error
27.endif
28.if ${:Uprevious value:!echo word; false!} != "word"
29.  error
30.endif
31
32all:
33