bug-bash
[Top][All Lists]
Advanced

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

Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]


From: Chet Ramey
Subject: Re: [bash arithmetic bugs with "++","--","+=1" and "-=1"]
Date: Fri, 13 Jun 2025 12:50:06 -0400
User-agent: Mozilla Thunderbird

On 6/13/25 10:23 AM, Todd Zullinger wrote:

The issue is stated as:

     let is very similar to (( - the only difference being
     let is a builtin (simple command), and (( is a compound
     command.  The arguments to let are therefore subject to
     all the same expansions and substitutions as any other
     simple command - requiring proper quoting and escaping -
     whereas the contents of (( aren't subject to
     word-splitting or pathname expansion (almost never
     desirable for arithmetic). For this reason, the
     arithmetic compound command should generally be
     preferred over let.[0]

You might find this discussion interesting. It discusses the problems with
double-evaluation of array subscripts and describes the changes that ended
up in bash-5.2.


https://lists.gnu.org/archive/html/bug-bash/2021-03/msg00056.html

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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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