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:
Tue, 12 Jan 2010 10:16:41 +0000 (UTC)
User-agent:
slrn/pre1.0.0-16 (Linux)
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.
I think by "everyone", you mean "AT&T ksh" and "zsh" or do you
know any other shell or language that behaves like that?
--
Stéphane