Christoph Anton Mitterer wrote:
> On Tue, 2011-05-24 at 17:27 -0500, Jonathan Nieder wrote:

>>      The value n shall be an unsigned integer less than or equal to
>>      the value of the special parameter '#'.
>> 
>> so conforming applications will never run into this.
>
> Not sure whether this is meant as "it's undefined to use values > $#".

The Introduction, ยง1.5 "Terminology" says:

        shall

        For an implementation that conforms to POSIX.1-2008, describes
        a feature or behavior that is mandatory. An application can
        rely on the existence of the feature or behavior.

        For an application or user, describes a behavior that is
        mandatory.

So much for the letter of the standard.  I agree that it could be
made clearer --- for example, the Application Usage section could
point out that shells differ from one another on this point.  A survey
of some shells on this machine:

        $ bash -c 'shift 20; echo $?'; echo $?
        1
        0
        $ zsh -c 'emulate sh; shift 20; echo $?'; echo $?
        zsh:shift:1: shift count must be <= $#
        1
        0
        $ dash -c 'shift 20; echo $?'; echo $?
        dash: 1: shift: can't shift that many
        2
        $ ksh93 -c 'shift 20; echo $?'; echo $?
        ksh93[1]: shift: 20: bad number
        1
        $ pdksh -c 'shift 20; echo $?'; echo $?; # likewise with mksh, posh
        pdksh: shift: nothing to shift
        1

> See http://austingroupbugs.net/view.php?id=459

Thanks again for working on this.

Cheers,
Jonathan



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to