Bash needs another newline to execute pasted lines

bashclipboard

My usual shell is bash, my usual terminal is xterm, on Debian Sid.

Following a recent release of bash, when I use button-2 to paste some text (selected by clicking and dragging button-1) into the bash command line I have that new lines in the pasted text are, so to say, inactive and I have to give an additional newline from the keyboard to execute the pasted text.

It seems to me something that Debian newly configured in bash, because if I use another shell (e.g., dash) the pasted lines are immediately executed, as it happened in bash and in all the shells I've previously used.

Is it possible to revert bash behaviour to the old one?


from dpkg -l

ii  bash           5.1-2        amd64        GNU Bourne Again SHell
ii  xterm          363-1        amd64        X terminal emulator

from uname -a

Linux debian 5.10.0-1-amd64 #1 SMP Debian 5.10.5-1 (2021-01-09) x86_64 GNU/Linux

Best Answer

I was put on track by Jeff Schaller's comment, Thank you Jeff!

It's a relatively new behaviour, bracketed pasteยน, that until now was not enabled by default on my distribution.

To disable bracketed paste, you just have to type, at the shell prompt,

$ echo set enable-bracketed-paste off >> ~/.inputrc

and start a new shell.


[1] bracketed paste is described in the bash(1) manual page, under the heading Readline variables

Related Question