Re: if then elif then else fi -- Problem report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux