DASH Shell discussions
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Malcolm Kay <malcolm.kay@internode.on.net>
Cc: dash@vger.kernel.org
Subject: Re: if then elif then else fi -- Problem report
Date: Tue, 29 Jun 2010 06:56:56 -0600	[thread overview]
Message-ID: <4C29ED98.2020302@redhat.com> (raw)
In-Reply-To: <201006291038.31206.malcolm.kay@internode.on.net>

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

On 06/28/2010 07:08 PM, Malcolm Kay wrote:
> Eric,
> Thanks for the clarification.
> 
> I had assumed that 'dash' aimed to be a faster replacement for 
> the classical Bourne shell 'sh' as implemented in BSD systems,

Rather, 'dash' aims to be the fastest and smallest possible
POSIX-compliant shell; anywhere that POSIX disagrees with traditional
Bourne shell behavior, POSIX triumphs.  Not all BSD system /bin/sh are
POSIX compliant.  And while dash has some extensions over POSIX, the
goal of being smallest means that extensions are kept to a minimum
(contrast that with bash or zsh, which both have a goal of providing as
many useful extensions as possible at the expense of size and sometimes
speed).

> As it is I feel the man pages should not only be fixed in this 
> respect, but also such differences to classical 'sh' 
> implementations should be high lighted.

There are other existing online resources that describe differences
between Bourne shell and POSIX.  But it is a much bigger effort to
document how dash differs from non-POSIX shells than it is to just
document how dash itself behaves.

> 
> On Mon, 28 Jun 2010 10:52 pm, Eric Blake wrote:
>> . . .
>>
>> Therefore, the bug is in the man page.  Per POSIX,
>> http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_ch
>> ap02.html#tag_18_09_03 "A list is a sequence of one or more
>> AND-OR lists separated by the operators ';' and '&' and
>> optionally terminated by ';' , '&' , or <newline>."
> 
> While I agree with your conclusions, I would note that POSIX
> defines "if ... else etc." in terms of 'compound_list' rather 
> than 'list' so the above definition of 'list' is not really 
> relevant. By my reading of your reference it seems POSIX defines 
> 'list' and 'compound_list' independently but fails to clarify
> the difference if any.

POSIX defines compound_list quite clearly.  Read the grammar section:
http://www.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_10_02

compound_list    :              term
                 | newline_list term
                 |              term separator
                 | newline_list term separator

It also defines list:

list             : list separator_op and_or
                 |                   and_or

The difference between the two is how newlines serve to separate the
various and_or lists.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

  reply	other threads:[~2010-06-29 12:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28 12:56 if then elif then else fi -- Problem report Malcolm Kay
2010-06-28 13:22 ` Eric Blake
2010-06-29  1:08   ` Malcolm Kay
2010-06-29 12:56     ` Eric Blake [this message]
2010-07-04 21:50     ` Sven Mascheck
2010-07-06  7:48       ` Malcolm Kay
2010-07-06 20:49         ` Sven Mascheck

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=4C29ED98.2020302@redhat.com \
    --to=eblake@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=malcolm.kay@internode.on.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox