zsh-workers
 help / color / mirror / code / Atom feed
* Problems in `zshmisc` manual page
@ 2022-04-24  7:12 Emily Seville
  2022-04-24  8:12 ` Lawrence Velázquez
  0 siblings, 1 reply; 2+ messages in thread
From: Emily Seville @ 2022-04-24  7:12 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 3325 bytes --]

There are several issues in complex commands descriptions.

*if command*
>
> if list then list [ elif list then list ] ... [ else list ] fi
>               The  if list is executed, and if it returns a zero exit
> status, the then list is executed.  Otherwise, the elif list is executed
>               and if its status is zero, the then list is executed.  If
> each elif list returns nonzero status, the else list is executed.


There is no mention of a terminator after *list*. It's better to rewrite
command description as:

if list *term* then list *term* [ elif list *term *then list *term *] ... [
> else list *term *] fi

              The  if list is executed, and if it returns a zero exit
> status, the then list is executed.  Otherwise, the elif list is executed
>               and if its status is zero, the then list is executed.  If
> each elif list returns nonzero status, the else list is executed.


*for command*

>        for name ... [ in word ... ] term do list done
>               Expand the list of words, and set the parameter name to each
> of them in turn, executing list each time.  If  the  `in  word'  is
>               omitted, use the positional parameters instead of the words.
>               The term consists of one or more newline or ; which
> terminate the words, and are optional when the `in word' is omitted.
>               More  than one parameter name can appear before the list of
> words.  If N names are given, then on each execution of the loop the
>               next N words are assigned to the corresponding parameters.
> If there are more names than remaining words, the remaining  parame‐
>               ters  are each set to the empty string.  Execution of the
> loop ends when there is no remaining word to assign to the first name.
>               It is only possible for in to appear as the first name in
> the list, else it will be treated as marking the end of the list.

It's better to write at my glance:

>        for name ... [ in word ... ] term do list *term* done
>               Expand the list of words, and set the parameter name to each
> of them in turn, executing list each time.  If  the  `in  word'  is
>               omitted, use the positional parameters instead of the words.
>               The term consists of one or more newline or ; which
> terminate the words, and are optional when the `in word' is omitted.
>               More  than one parameter name can appear before the list of
> words.  If N names are given, then on each execution of the loop the
>               next N words are assigned to the corresponding parameters.
> If there are more names than remaining words, the remaining  parame‐
>               ters  are each set to the empty string.  Execution of the
> loop ends when there is no remaining word to assign to the first name.
>               It is only possible for in to appear as the first name in
> the list, else it will be treated as marking the end of the list.

The same issues applies for:

   - for (second form)
   - while
   - until
   - repeat

-- 
*# Best regards, Emily Grace Seville.*
*[contacts]*
site *=* "*https://emilyseville7cfg.github.io/about/
<https://emilyseville7cfg.github.io/about/>"*
phone *=* "+79247259451*"*

[-- Attachment #2: Type: text/html, Size: 5350 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-24  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  7:12 Problems in `zshmisc` manual page Emily Seville
2022-04-24  8:12 ` Lawrence Velázquez

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).