[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI for i; do
From: |
Akim Demaille |
Subject: |
FYI for i; do |
Date: |
10 Nov 2000 15:15:27 +0100 |
User-agent: |
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands) |
2000-11-10 Akim Demaille <address@hidden>
* doc/autoconf.texi (Limitations of Builtins): `for i; do'.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.377
diff -u -u -r1.377 autoconf.texi
--- doc/autoconf.texi 2000/11/10 12:10:13 1.377
+++ doc/autoconf.texi 2000/11/10 14:21:14
@@ -5415,6 +5415,35 @@
Therefore you should @command{export} again each environment variable
you update.
address@hidden @command{for}
address@hidden @command{for}
+To loop over positional arguments, use
+
address@hidden
+for arg
+do
+ echo "$arg"
+done
address@hidden example
+
address@hidden
+You may @emph{not} leave the @code{do} on the same line as @code{for},
+since some shells improperly grok
+
address@hidden
+for arg; do
+ echo "$arg"
+done
address@hidden example
+
+If you want to explicitly refer to the positional arguments, given the
address@hidden@@} bug (@pxref{Shell Substitutions}), use:
+
address@hidden
+for arg in ${1+"$@@"}; do
+ echo "$arg"
+done
+
@item @command{if}
@cindex @command{if}
Using @samp{!} is not portable. Instead of
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI for i; do,
Akim Demaille <=