zsh-workers
 help / color / mirror / code / Atom feed
From: Emily Seville <emilyseville7cf@gmail.com>
To: zsh-workers@zsh.org
Subject: Problems in `zshmisc` manual page
Date: Sun, 24 Apr 2022 17:12:54 +1000	[thread overview]
Message-ID: <CAGVHxD2-eb2T8oDfD7HutcnYA7t0BCfpDiQm_bEWG-xnzi7Atw@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2022-04-24  7:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24  7:12 Emily Seville [this message]
2022-04-24  8:12 ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGVHxD2-eb2T8oDfD7HutcnYA7t0BCfpDiQm_bEWG-xnzi7Atw@mail.gmail.com \
    --to=emilyseville7cf@gmail.com \
    --cc=zsh-workers@zsh.org \
    --subject='Re: Problems in `zshmisc` manual page' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).