bug-bash
[Top][All Lists]
Advanced

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

Re: Problems when RANDOM without $ is used as an array index


From: DennisW
Subject: Re: Problems when RANDOM without $ is used as an array index
Date: Wed, 20 Jan 2010 10:12:26 -0800 (PST)
User-agent: G2/1.0

On Jan 20, 7:28 am, Stephane CHAZELAS <address@hidden>
wrote:
> 2010-01-12 22:07:31 -0500, Chet Ramey:
>
>
>
> > On 1/12/10 5:16 AM, Stephane CHAZELAS wrote:
> > > 2010-01-11, 17:42(-05), Chet Ramey:
> > >>>> Think of it as
>
> > >>>> x = $(( RANDOM%6+1 + RANDOM%6+1 ))
> > >>>> y = dice[x]
> > >>>> dice[RANDOM%6+1 + RANDOM%6+1] = y + 1
> > >>>> return y
> > >>> [...]
>
> > >>> I would still consider that a bug.
>
> > >> OK.  But everyone does it the same way.
>
> > > Except for pdksh, mksh, posh, perl, C.
>
> > The three shells in your list are all variants of the same base.  It's
> > like using three different releases of bash.  The other two aren't
> > shells.  C is a reasonable comparison, but there are other differences
> > in how the languages are parsed and executed.
>
> > > I think by "everyone", you mean "AT&T ksh" and "zsh" or do you
> > > know any other shell or language that behaves like that?
>
> > I haven't done an extensive investigation.  It's not really a significant
> > issue.  It's important enough that bash, ksh, and zsh agree.  We don't
> > need more incompatibilities between the major shells.
>
> [...]
>
> Hi Chet,
>
> Please note that that bug has now been fixed in 
> ksh93:http://mailman.research.att.com/pipermail/ast-developers/2010q1/00055...
> so they don't agree anymore.
>
> --
> Stephane

I wasn't able to access that link until I changed it to https

https://mailman.research.att.com/pipermail/ast-developers/2010q1/000550.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]