[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Does the parser backtrack?
From: |
Chet Ramey |
Subject: |
Re: [Help-bash] Does the parser backtrack? |
Date: |
Tue, 4 Oct 2016 11:14:35 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 10/4/16 10:22 AM, Daniel Martí wrote:
> But sometimes, bash doesn't treat $(( as the start of an arithmetic
> expansion.
>
> $ echo $((echo foo) | cat)
> foo
>
> This seems weird to me, as $(( is a POSIX Shell token.
$(( is not a token; it's part of a word expansion. As you discovered,
it takes more context to decide how to expand that portion of a word.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/