|
From: | phil colbourn |
Subject: | Re: ++ causes 2 variables to increment |
Date: | Tue, 17 May 2016 20:00:10 +0100 |
On Sun, May 15, 2016 at 4:42 PM, phil colbourn <philcolbourn@gmail.com> wrote:> # here, M=2
It's not -- the value of $M here is the string "F[word]". Your print function reports the value of "$((M*1))", which is, in fact "2": inside the arithmetic _expression_ "M" is expanded to "F[word]" which is expanded to "2".> # without changing M, it is now 3!!!!!!Exactly, M does not change, it is still "F[word]". But since F[word] changes, the value of $((M*1)) does change to reflect the new value of F[word].Instead of M=F[$W], I think you want to be doing M=${F[$W]}.
[Prev in Thread] | Current Thread | [Next in Thread] |