Re: /dev/fd/63: line 21: ((: takes && kwsi += takes : attempted assignment to non-variable (error token is "+= takes ")
Date:
Wed, 9 Feb 2022 20:49:45 +0100
thank you much'est'ly sir
On Wed, Feb 9, 2022 at 8:48 PM Dennis Williamson
<dennistwilliamson@gmail.com> wrote:
>
>
>
> On Wed, Feb 9, 2022, 1:37 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>>
>> i try, and in this it isplays me this
>>
>> short -x lines
>>
>> +++ declare kwsi= kw id code takes _t
>> +++ takes=
>> +++ (( takes && kwsi += takes ))
>> /dev/fd/63: line 21: ((: takes && kwsi += takes : attempted assignment
>> to non-variable (error token is "+= takes ")
>>
>> i dunno ? any help ?
>>
>> i notice a space more between (( and takes
>> also takes is = [0] so += doesnt run, and in declare before kwsi is
>> even declared
>>
>> help ?
>>
>
>
> If you're trying to make the incrementing of kwsi conditional on the value of
> takes, you need to group the increment assignment
>
> (( takes && (kwsi += takes) ))
>
> Otherwise it's trying to assign the increment to the result of the boolean &&
> which is the integer 0 or 1 which are non-variables.