help-bash
[Top][All Lists]
Advanced

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

Re: is it really required that arr['1']=bla gives syntax error instead o


From: Jesse Hathaway
Subject: Re: is it really required that arr['1']=bla gives syntax error instead of parse '1' as 1
Date: Mon, 19 Jul 2021 13:19:24 -0500

On Mon, Jul 19, 2021 at 1:00 PM Greg Wooledge <greg@wooledge.org> wrote:
> unicorn:~$ ksh
> $ echo $(('1' + 2))
> 51
> $ echo $(("1" + 2))
> 3
> $ echo $(("1 + 2"))
> 3
> $ echo $((""1 + 2))
> 3

strangely ksh does seem to behave sanely in an array context:

$ aa['1']=butter
$ aa['1' + 2]=bubbles
$ typeset -p aa
typeset -a aa=([1]=butter [3]=bubbles)



reply via email to

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