help-bash
[Top][All Lists]
Advanced

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

Re: whats wrong with (( a = 8 , a > 4 && a -= 2 || a-- )) , bash: ((: a


From: alex xmb ratchev
Subject: Re: whats wrong with (( a = 8 , a > 4 && a -= 2 || a-- )) , bash: ((: a = 8 , a > 4 && a -= 2 || a-- : attempted assignment to non-variable (error token is "-= 2 || a-- ")
Date: Thu, 23 Mar 2023 12:14:18 +0100

to my good surprise it works one level higher too

(( a = 8 , a > 4 ? a -= 2 : a-- ))

thanks mate

On Thu, Mar 23, 2023, 12:03 alex xmb ratchev <fxmbsw7@gmail.com> wrote:

>
> ---------- Forwarded message ---------
> From: alex xmb ratchev <fxmbsw7@gmail.com>
> Date: Thu, Mar 23, 2023, 12:03
> Subject: Re: whats wrong with (( a = 8 , a > 4 && a -= 2 || a-- )) , bash:
> ((: a = 8 , a > 4 && a -= 2 || a-- : attempted assignment to non-variable
> (error token is "-= 2 || a-- ")
> To: Reuti <reuti@staff.uni-marburg.de>
>
>
>
>
> On Thu, Mar 23, 2023, 11:49 Reuti <reuti@staff.uni-marburg.de> wrote:
>
>>
>> > Am 23.03.2023 um 11:35 schrieb alex xmb ratchev <fxmbsw7@gmail.com>:
>> >
>> > or one small deeper parsing bug
>> >
>> > ~ $ (( a = 8 , a > 4 && a -= 2 ))
>> > bash: ((: a = 8 , a > 4 && a -= 2 : attempted assignment to non-variable
>> > (error token is "-= 2 ")
>>
>> This could be written as:
>>
>> (( a = 8 , a= a > 4 ? a-2 : a ))
>>
>
> oic yes ill code that so thxx
>
> The && is already used for logical AND like:
>>
>
> oic2 i dunno those
>
> ((a= c==8 && d==9 ))
>>
>> -- Reuti
>>
>
> thanks mate , /xmb
>
> >
>> > i can only agree to enable such basic functionment
>> >
>> > greets ..
>> >
>> > On Thu, Mar 23, 2023, 11:32 alex xmb ratchev <fxmbsw7@gmail.com> wrote:
>> >
>> >> i remember doing && (( code
>> >> maybe i didnt '=' in action there
>> >>
>> >> (( a = 8 , a > 4 && a -= 2 || a-- ))
>> >>
>> >> bash: ((: a = 8 , a > 4 && a -= 2 || a-- : attempted assignment to
>> >> non-variable (error token is "-= 2 || a-- ")
>> >>
>> >>
>> >> (( a = 8 , a > 4 && a-- && a-- || a-- ))
>> >>
>> >> works
>> >> a=6
>> >>
>> >> ..
>> >> i suppose this is a (( lex bug where u didnt include || && in op for =
>> >>
>> >> is it ? :))
>> >>
>> >> greets
>> >>
>>
>>


reply via email to

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