From: Akim Demaille Date: Fri, 10 Nov 2000 14:24:46 +0000 (+0000) Subject: * doc/autoconf.texi (Limitations of Builtins): `for i; do'. X-Git-Tag: autoconf-2.50~445 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2329b45d342b2b32a7c8d44e65c188740568cc4;p=thirdparty%2Fautoconf.git * doc/autoconf.texi (Limitations of Builtins): `for i; do'. --- diff --git a/ChangeLog b/ChangeLog index 4d49ecf2e..84555d7fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2000-11-10 Akim Demaille + + * doc/autoconf.texi (Limitations of Builtins): `for i; do'. + 2000-11-10 Akim Demaille * doc/autoconf.texi (Shellology): Some about /usr/xpg4/bin/sh on diff --git a/doc/autoconf.texi b/doc/autoconf.texi index cb3bc20ab..56ee31a60 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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