[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems when RANDOM without $ is used as an array index
From: |
Stephane CHAZELAS |
Subject: |
Re: Problems when RANDOM without $ is used as an array index |
Date: |
Wed, 20 Jan 2010 13:28:52 +0000 |
User-agent: |
Mutt/1.5.16 (2007-09-19) |
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/000550.html
so they don't agree anymore.
--
Stephane
- Problems when RANDOM without $ is used as an array index, dennis, 2010/01/09
- Re: Problems when RANDOM without $ is used as an array index, Stephane CHAZELAS, 2010/01/11
- Re: Problems when RANDOM without $ is used as an array index, Chet Ramey, 2010/01/11
- Re: Problems when RANDOM without $ is used as an array index, Stephane CHAZELAS, 2010/01/11
- Message not available
- Re: Problems when RANDOM without $ is used as an array index, Stephane CHAZELAS, 2010/01/11
- Re: Problems when RANDOM without $ is used as an array index, Chet Ramey, 2010/01/11
- Re: Problems when RANDOM without $ is used as an array index, DennisW, 2010/01/11
- Message not available
- Re: Problems when RANDOM without $ is used as an array index, Stephane CHAZELAS, 2010/01/12
- Re: Problems when RANDOM without $ is used as an array index, Chet Ramey, 2010/01/12
- Re: Problems when RANDOM without $ is used as an array index,
Stephane CHAZELAS <=
- Message not available
- Re: Problems when RANDOM without $ is used as an array index, DennisW, 2010/01/20