bug-bash
[Top][All Lists]
Advanced

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

Re: Arithmetic expression: evaluation order bug


From: Chet Ramey
Subject: Re: Arithmetic expression: evaluation order bug
Date: Wed, 4 Jan 2023 10:25:19 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 12/30/22 4:23 AM, Robert Elz wrote:

For what it is worth, I tested a bunch of shells with the original
expressions, all ksh variants, bosh, and bash evaluate the original
expressions the bash way, all ash variants, plus yash and zsh implement
it the dash way.   Neither is incorrect.

It really comes down to when you fetch the value on the lhs. Do you save
the variable name and fetch its value after you evaluate the rhs, or do you
get the lhs value at the same time you save the name?

--
``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/




reply via email to

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