Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Problems in `zshmisc` manual page



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/"
phone = "+79247259451"


Messages sorted by: Reverse Date, Date, Thread, Author