]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Limitations of Builtins): `for i; do'.
authorAkim Demaille <akim@epita.fr>
Fri, 10 Nov 2000 14:24:46 +0000 (14:24 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 10 Nov 2000 14:24:46 +0000 (14:24 +0000)
ChangeLog
doc/autoconf.texi

index 4d49ecf2e02b93b6756480741868905134a6e4c2..84555d7fc63e6ba21d5798e2df3d543d1200bff8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-11-10  Akim Demaille  <akim@epita.fr>
+
+       * doc/autoconf.texi (Limitations of Builtins): `for i; do'.
+
 2000-11-10  Akim Demaille  <akim@epita.fr>
 
        * doc/autoconf.texi (Shellology): Some about /usr/xpg4/bin/sh on
index cb3bc20ab34c867022651ab01849dd6fdeaa08ed..56ee31a60f14750153f69567f870a9b66818bdb3 100644 (file)
@@ -5415,6 +5415,35 @@ alternately @samp{foo} and @samp{bar}, although it should only print
 Therefore you should @command{export} again each environment variable
 you update.
 
+@item @command{for}
+@cindex @command{for}
+To loop over positional arguments, use
+
+@example
+for arg
+do
+  echo "$arg"
+done
+@end example
+
+@noindent
+You may @emph{not} leave the @code{do} on the same line as @code{for},
+since some shells improperly grok
+
+@example
+for arg; do
+  echo "$arg"
+done
+@end example
+
+If you want to explicitly refer to the positional arguments, given the
+@samp{$@@} bug (@pxref{Shell Substitutions}), use:
+
+@example
+for arg in ${1+"$@@"}; do
+  echo "$arg"
+done
+
 @item @command{if}
 @cindex @command{if}
 Using @samp{!} is not portable.  Instead of