Thanks Grisha, Sorry for putting you through analysing my faulty example.
Phil On 16 May 2016 at 05:58, Grisha Levit <grishale...@gmail.com> wrote: > > On Sun, May 15, 2016 at 4:42 PM, phil colbourn <philcolbo...@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]}. >