Updated patch with break, shift and continue commands documentation
copied as it is from BASH man page and with other suggestions is
attached.


On Fri, Sep 3, 2010 at 4:45 AM, Colin Watson <cjwat...@ubuntu.com> wrote:
> On Fri, Aug 20, 2010 at 04:18:14PM +0530, BVK Chaitanya wrote:
>>  The special variable name @samp{?} expands to the exit status of the most
>> -recently executed command.
>> +recently executed command.  When positional variable names are active, other
>> +special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
>> +expand to all positional parameters with necessary quoting, positional
>> +parameters without any quoting, and positional parameter count respectively.
>
> So does this have different magic quoting properties from bash, then?
> In bash, $@ and $* have specially-defined expansions when they occur
> within double quotes.  If GRUB script is different then I think it would
> be worth spelling out the differences.
>

No, their behavior is completely similar to BASH semantics.




bvk.chaitanya
=== modified file 'docs/grub.texi'
--- docs/grub.texi	2010-09-01 09:29:30 +0000
+++ docs/grub.texi	2010-09-04 15:59:27 +0000
@@ -1227,8 +1227,10 @@
 The backslash retains its special meaning only when followed by one of the
 following characters: @samp{$}, @samp{"}, @samp{\}, or newline.  A
 backslash-newline pair is treated as a line continuation (that is, it is
-removed from the input stream and effectively ignored).  A double quote may
-be quoted within double quotes by preceding it with a backslash.
+removed from the input stream and effectively igno...@footnote{currently a
+backslash-newline pair within a variable name is not handled properly, so
+use this feature with some care.}.).  A double quote may be quoted within
+double quotes by preceding it with a backslash.
 
 @heading Variable expansion
 
@@ -1240,11 +1242,15 @@
 Normal variable names begin with an alphabetic character, followed by zero
 or more alphanumeric characters.
 
-Positional variable names consist of one or more digits.  These are reserved
-for future expansion.
+Positional variable names consist of one or more digits.  They represent
+parameters passed to function calls, with @samp{$1} representing the first
+parameter, and so on.
 
 The special variable name @samp{?} expands to the exit status of the most
-recently executed command.
+recently executed command.  When positional variable names are active, other
+special variable names @samp{@@}, @samp{*} and @samp{#} are defined and they
+expand to all positional parameters with necessary quoting, positional
+parameters without any quoting, and positional parameter count respectively.
 
 @heading Comments
 
@@ -1305,6 +1311,38 @@
 @xref{menuentry}.
 @end table
 
+...@heading Built-in Commands
+
+Some built-in commands are also provided by GRUB script to help script
+writers perform actions that are otherwise not possible.  For example, these
+include commands to jump out of a loop without fully completing it, etc.
+
+...@table @asis
+...@item break [...@code{n}]
+Exit from within a @code{for}, @code{while}, or @code{until} loop.  If
+...@code{n} is specified, break @code{n} levels.  @code{n} must be greater than
+or equal to 1.  If @code{n} is greater than the number of enclosing loops,
+all enclosing loops are exited.  The return value is 0 unless @code{n} is
+not greater than or equal to 1.
+
+...@item continue [...@code{n}]
+Resume the next iteration of the enclosing @code{for}, @code{while} or
+...@code{until} loop.  If @code{n} is specified, resume at the @code{n}th
+enclosing loop.  @code{n} must be greater than or equal to 1.  If @code{n}
+is greater than the number of enclosing loops, the last enclosing loop (the
+``top-level'' loop) is resumed.  The return value is 0 unless @code{n} is
+not greater than or equal to 1.
+
+...@item shift [...@code{n}]
+The positional parameters from @code{n}+1 ... are renamed to @code{$1}... .
+Parameters represented by the numbers @code{$#} down to @code{$...@code{n}+1
+are unset.  @code{n} must be a non-negative number less than or equal to
+...@code{$#}.  If @code{n} is 0, no parameters are changed.  If @code{n} is not
+given, it is assumed to be 1.  If @code{n} is greater than @code{$#}, the
+positional parameters are not changed.  The return status is greater than
+zero if @code{n} is greater than @code{$#} or less than zero; otherwise 0.
+
+...@end table
 
 @node Embedded configuration
 @section Embedding a configuration file into GRUB

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to