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: Lawrence Velázquez
Subject: Re: is it really required that arr['1']=bla gives syntax error instead of parse '1' as 1
Date: Mon, 19 Jul 2021 15:41:57 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-533-gf73e617b8a-fm-20210712.002-gf73e617b

On Mon, Jul 19, 2021, at 2:19 PM, Jesse Hathaway wrote:
> 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)

Not *that* sanely.

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

Looks like it's just performing quote removal before arithmetic
evaluation.

-- 
vq



reply via email to

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