bug-bash
[Top][All Lists]
Advanced

[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: Tue, 2 May 2017 09:48:59 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.0.1

On 5/2/17 12:41 AM, Eduardo Bustamante wrote:
> On Mon, Apr 24, 2017 at 3:48 PM, Chet Ramey <address@hidden> wrote:
> [...]
>> That works on Linux, but not on the BSDs, since Posix says it doesn't
>> have to.
> 
> I see that a test for this has been added to comsub.tests:
> 
> address@hidden:~/src/gnu/bash$ git log -1 -p -- tests/comsub.tests
> commit 2a39157723ffb7dfc597dfa46b5b6fbd93cc9ea2
> Author: Chet Ramey <address@hidden>
> Date:   Mon May 1 15:46:46 2017 -0400
> 
>     commit bash-20170428 snapshot
> 
> diff --git a/tests/comsub.tests b/tests/comsub.tests
> index e8fab711..fceea00f 100644
> --- a/tests/comsub.tests
> +++ b/tests/comsub.tests
> @@ -44,6 +44,12 @@ bar')
>  # long-standing parse error in all versions up through bash-4.3
>  echo ${foo:-$(echo a{b,c})} >/dev/null
> 
> +# parsing problem based on recursively calling bison parser through bash-4.4
> +for (( INDEX=0; INDEX<$((10-$(expr length $V_NAME))); INDEX++ ))
> +do
> +       :
> +done
> +
>  ${THIS_SH} ./comsub1.sub
>  ${THIS_SH} ./comsub2.sub
>  ${THIS_SH} ./comsub3.sub
> 
> 
> But in my system (Debian 9, expr from GNU coreutils 8.26-3):
> 
> address@hidden:~/src/gnu/bash$ expr length
> expr: syntax error

Changing `expr' to `echo' is enough.

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



reply via email to

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