The officially official Devuan Forum!

You are not logged in.

#1 2022-09-19 19:12:40

kaiyel
Member
Registered: 2019-10-16
Posts: 27  

HOWTO : enable pasting linefeed-separated commands into bash terminal

Hat tip to Chris Siebenmann :

https://utcc.utoronto.ca/~cks/space/blo … asteChange

I regularly paste short lists of linefeed separated commands from a library of various instructions into bash terminal windows to accomplish small tasks.

The bash shell on my devuan system accepts the pasted content, but waits for a final interactive <enter> keypress before proceeding with command execution.  I've not experienced that interactive <enter> confirmation requirement before.  I understand it allows folks one last read of the commands before execution, so it's not necessarily a bad default.  But after giving myself some time to try and get used to it, I've decided it's just not for me.  If I copied the linefeed and pasted it, it is because I wanted the command executed ... every single time.

Thanks to Chris Siebenmann's blog I learned this interactive confirmation is a new feature of bash that can be turned off by appending this change to the "/etc/bash.bashrc" configuration :

bind 'set enable-bracketed-paste off'

Start a new shell and I'm back to middle-mouse clicking my pasted commands without having to touch the keyboard.  A "win" for me; maybe for you too.

--K

Offline

#2 2022-09-19 22:27:21

GlennW
Member
From: Brisbane, Australia
Registered: 2019-07-18
Posts: 644  

Re: HOWTO : enable pasting linefeed-separated commands into bash terminal

Thank you for this solution. when I paste a command into a shell I also expect it to execute.


pic from 1993, new guitar day.

Offline

#3 2022-09-20 15:00:19

Camtaf
Member
Registered: 2019-11-19
Posts: 436  

Re: HOWTO : enable pasting linefeed-separated commands into bash terminal

Hmm, I prefer it not automatically reacting - I use shell scripts if I want multi instructions operated.

(I only had one instance of auto executing on some other distro, & thought it to be a rather dodgy set up, needless to say, I ditched that particular distro promptly).

Still, we're all different, & like different things - just adding my two penneth to let our devs know that some like it how it is. wink

Offline

#4 2022-09-20 15:51:02

kaiyel
Member
Registered: 2019-10-16
Posts: 27  

Re: HOWTO : enable pasting linefeed-separated commands into bash terminal

Fair smile

As mentioned in the detailed Bash list of changes, bracketed paste mode was enabled by default starting in bash-5.1-alpha.

For folk like me, bash 5.x is a shiny new thing and losing the default ability to immediately execute pasted commands is a change to decades old behavior.  I doubt Devuan (or Debian) devs will stray from the new defaults established by bash devs -- so I think you are in good shape.  And to their monumental credit, the bash devs gave us an easy way to restore old behavior.  In the future, should the bash devs determine the old way was the more common usage and change the default back, this same bashrc tweak can be reversed to turn the new behavior back "on" for you as well.

Offline

#5 2022-09-20 18:22:33

delgado
Member
Registered: 2022-07-14
Posts: 212  

Re: HOWTO : enable pasting linefeed-separated commands into bash terminal

Thanks a lot - that new feature made me nuts!

Offline

Board footer