23 Şubat 2021 Salı tarihinde Greg Wooledge <g...@wooledge.org> yazdı:
> Oğuz (oguzismailuy...@gmail.com) wrote: > > `(( assoc[\$var]++ ))' works fine as usual. > > unicorn:~$ bash-5.1 > unicorn:~$ declare -A hash > unicorn:~$ key=\'\] > unicorn:~$ hash[$key]=17 > unicorn:~$ (( hash[\$key]++ )) > unicorn:~$ declare -p hash > declare -A hash=(["']"]="18" ) > unicorn:~$ (( 'hash[$key]'++ )) > bash-5.1: ((: 'hash[']]'++ : syntax error: operand expected (error token > is "'hash[']]'++ ") > unicorn:~$ (( hash['$key']++ )) > bash-5.1: ((: hash['']']++ : syntax error: invalid arithmetic operator > (error token is "']++ ") > unicorn:~$ (( hash['$'key]++ )) > unicorn:~$ declare -p hash > declare -A hash=(["\$key"]="1" ["']"]="18" ) > > I understand absolutely none of this. Quoting the $ works, but only > if you quote it with a backslash, not with single quotes? And quoting > any other characters besides the $ fails? Neither do I :D I was told in this list that quote removal rules for `(( ... ))' were changed recently, but I have yet to understand why and how. > > Sorry, I'm still going with "this stuff's broken -- don't use it". > I agree with this. -- Oğuz