|
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 18:06:18 +0100 |
On Thu, Mar 23, 2023, 17:43 Kerin Millar <kfm@plushkava.net> wrote: > On Thu, 23 Mar 2023 21:36:38 +0530 > Bipul kumar <bipul.opensource@gmail.com> wrote: > > > Let me explain here > > The -= operator performs a compound subtraction and assignment operation, > > which modifies the value of the variable on the left-hand side of the > > operator. > > Also it looks within a logical expression like this a -= 2 , Bash does > not > > allow any left side effects to occur. > > So in order to make it work as it insists bash to perform in an isolated > > subshell only a - = 2 NO ANY OTHER LOGICAL EXPRESSION Because it's a > > There are no subshells involved at any juncture. Perhaps you are confusing > the use of parentheses inside an arithmetic expression with the (list) > compound command? > compound assignment , he wrote is small in the docs and imo i think he just said subshell substituting the ( and ) ' inside ' thing greets -- > Kerin Millar >
[Prev in Thread] | Current Thread | [Next in Thread] |