help-bash
[Top][All Lists]
Advanced

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

Re: Shell Expansion


From: Chet Ramey
Subject: Re: Shell Expansion
Date: Wed, 14 Apr 2021 09:32:55 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1

On 4/14/21 9:15 AM, Greg Wooledge wrote:

As for why bash chooses one over the other -- who knows?

"The syntax of the shell command language has an ambiguity for expansions
beginning with "$((", which can introduce an arithmetic expansion or a
command substitution that starts with a subshell. Arithmetic expansion has
precedence; that is, the shell shall first determine whether it can parse
the expansion as an arithmetic expansion and shall only parse the expansion
as a command substitution if it determines that it cannot parse the
expansion as an arithmetic expansion."

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03

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