[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Syntax error near unexpected token `newline' within loops
From: |
Chet Ramey |
Subject: |
Re: Syntax error near unexpected token `newline' within loops |
Date: |
Mon, 24 Apr 2017 16:42:07 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 4/24/17 6:59 AM, werner@suse.de wrote:
> Bash Version: 4.4
> Patch Level: 12
> Release Status: release
>
> Description:
> Since 4.3 including 4.4 bash shows a bug in loops using nested ((...)),
> $((..)), and $(...)
>
> Repeat-By:
> The bash code
>
> V_NAME=Friday
> for (( INDEX=0; INDEX<$((10-$(expr length $V_NAME))); INDEX++ ))
> do
> echo $INDEX
> done
>
> leads to
>
> bash: syntax error near unexpected token `newline'
Thanks for the report. It's a consequence of recursively invoking the
parser for the command substitution, which bash-4.3 and later do. There's
more and more yacc/bison internal state I find out about as these semi-
obscure reports come in. I'll fix it.
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://cnswww.cns.cwru.edu/~chet/