[Top][All Lists]

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

Incorrect mangling of multiline array assignment in history

From: Davide Brini
Subject: Incorrect mangling of multiline array assignment in history
Date: Mon, 04 Jun 2012 18:42:20 +0200

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=x86-64 
-mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 
-DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux beaker 3.3.7-1-ARCH #1 SMP PREEMPT Tue May 22 00:26:26 CEST 
2012 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.2
Patch Level: 29
Release Status: release

        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.


I'm not sure exactly when it happens, however this seems to more or less 
trigger it regularly:

$ xxx=(a b c d
> )

(we hit enter after the "d", to complete the assignment on the next line. ">" 
is the PS2 prompt)

$ declare -p xxx
declare -a xxx='([0]="a" [1]="b" [2]="c" [3]="d")'

Now hit up arrow twice to recall the array assignment and we get this:

$ xxx=(a b c d; )
-bash: syntax error near unexpected token `;'

        No idea!

reply via email to

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