[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ${a:=b} expands to `b', not `a''s value
From: |
Oğuz |
Subject: |
Re: ${a:=b} expands to `b', not `a''s value |
Date: |
Wed, 20 Jan 2021 19:58:45 +0300 |
On Wed, Jan 20, 2021 at 6:44 PM Chet Ramey <chet.ramey@case.edu> wrote:
> Thanks for the report. It's probably not what you intend, but it's the way
> bash has done things all the way back to bash-4.0 when the additional
> variable attributes were introduced (and further back if you consider the
> integer attribute).
> The way bash does it is that the word is expanded (to `X') and that value
> is assigned to a. That becomes the value of the expansion. The conversion
> is then performed, at a lower layer, on the assignment.
>
> This should only affect this particular parameter expansion involving
> variables where this kind of conversion takes place at assignment time. I
> think it would be reasonable to change the result to the final value of
> the variable for the next version and make the new behavior dependent on
> the shell compatibility level.
>
I agree. Thanks
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
>