On 6/4/12 12:42 PM, Davide Brini wrote:

> Bash Version: 4.2
> Patch Level: 29
> Release Status: release
> 
> Description:
>       To insert them in the history, bash converts multiline commands into a 
> single line, normally replacing newlines with semicolons. However, if the 
> multiline command happens to be an array assignment, adding the semicolon 
> isn't always correct.
> 
> Repeat-By:
> 
> I'm not sure exactly when it happens, however this seems to more or less 
> trigger it regularly:
> 
> $ xxx=(a b c d
>> )

It can, but it depends on the shell's state and the command before the
assignment statement.  The attached patch makes doing the right thing
explicit rather than relying on shell state.  It seems to work for me;
please try it and let me know.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/


*** ../bash-4.2-patched/parse.y	2011-11-21 18:03:36.000000000 -0500
--- parse.y	2012-06-07 12:48:47.000000000 -0400
***************
*** 4900,4905 ****
--- 4916,4924 ----
        return (current_command_line_count == 2 ? "\n" : "");
      }
  
+   if (parser_state & PST_COMPASSIGN)
+     return (" ");
+ 
    /* First, handle some special cases. */
    /*(*/
    /* If we just read `()', assume it's a function definition, and don't

Reply via email to