summaryrefslogtreecommitdiff
path: root/usr.bin/make/make.1
diff options
context:
space:
mode:
authoruwe <uwe@NetBSD.org>2022-08-14 21:53:58 +0000
committeruwe <uwe@NetBSD.org>2022-08-14 21:53:58 +0000
commit39385a8fc062a7b720d682cf2b2fa5ae6be5374d (patch)
tree916254bd12e5518e32e5c1c49acf8fb30c2d31dd /usr.bin/make/make.1
parent8c622047f80fe7ba89af39ca240afc059d2af2bd (diff)
make(1): prettify .for index variable example
Diffstat (limited to 'usr.bin/make/make.1')
-rw-r--r--usr.bin/make/make.132
1 files changed, 18 insertions, 14 deletions
diff --git a/usr.bin/make/make.1 b/usr.bin/make/make.1
index a7c44621f65..437183b1b71 100644
--- a/usr.bin/make/make.1
+++ b/usr.bin/make/make.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: make.1,v 1.327 2022/08/14 21:48:05 uwe Exp $
+.\" $NetBSD: make.1,v 1.328 2022/08/14 21:53:58 uwe Exp $
.\"
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -674,38 +674,42 @@ but only as far as necessary to determine the result of the conditional.
Variables in shell commands are expanded when the shell command is
executed.
.It
-.Dq .for
+.Ic .for
loop index variables are expanded on each loop iteration.
Note that other variables are not expanded when composing the body of a loop,
so the following example code:
.Bd -literal -offset indent
-
-.Dv .for i in 1 2 3
+\&.for i in 1 2 3
a+= ${i}
j= ${i}
b+= ${j}
-.Dv .endfor
+\&.endfor
all:
@echo ${a}
@echo ${b}
-
.Ed
+.Pp
will print:
.Bd -literal -offset indent
1 2 3
3 3 3
-
.Ed
-Because while ${a} contains
-.Dq 1 2 3
-after the loop is executed, ${b}
+.Pp
+Because while
+.Va a
+contains
+.Ql 1 2 3
+after the loop is executed,
+.Va b
contains
-.Dq ${j} ${j} ${j}
+.Ql ${j} ${j} ${j}
which expands to
-.Dq 3 3 3
-since after the loop completes ${j} contains
-.Dq 3 .
+.Ql 3 3 3
+since after the loop completes
+.Va j
+contains
+.Ql 3 .
.El
.Ss Variable classes
The four different classes of variables (in order of increasing precedence)